From 955333b0bc796d2835c11192de7571aad5f21a11 Mon Sep 17 00:00:00 2001 From: novichiv Date: Sun, 6 Mar 2016 22:06:11 +0300 Subject: [PATCH] Fixed strncpy in parse_imagepath --- extensions/parse_imagepath/ace_parse_imagepath.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/extensions/parse_imagepath/ace_parse_imagepath.cpp b/extensions/parse_imagepath/ace_parse_imagepath.cpp index fa1a8643e7..dc27d60c72 100644 --- a/extensions/parse_imagepath/ace_parse_imagepath.cpp +++ b/extensions/parse_imagepath/ace_parse_imagepath.cpp @@ -36,18 +36,17 @@ std::string getImagePathFromStructuredText(const std::string & input) { return returnValue; } -// i like to live dangerously. jk, fix strncpy sometime pls. #pragma warning( push ) #pragma warning( disable : 4996 ) void __stdcall RVExtension(char *output, int outputSize, const char *function) { ZERO_OUTPUT(); - if (!strcmp(function, "version")) { - strncpy(output, ACE_FULL_VERSION_STR, outputSize); - } else { - strncpy(output, getImagePathFromStructuredText(function).c_str(), outputSize); - output[outputSize - 1] = '\0'; - } + if (!strcmp(function, "version")) { + strncpy_s(output, outputSize, ACE_FULL_VERSION_STR, _TRUNCATE); + } else { + strncpy_s(output, outputSize, getImagePathFromStructuredText(function).c_str(), _TRUNCATE); + output[outputSize - 1] = '\0'; + } EXTENSION_RETURN(); }