diff --git a/src/detection/terminalshell/terminalshell.c b/src/detection/terminalshell/terminalshell.c index 92bd7294e..f4c8a076e 100644 --- a/src/detection/terminalshell/terminalshell.c +++ b/src/detection/terminalshell/terminalshell.c @@ -22,9 +22,11 @@ static bool getFileVersion(const FFstrbuf* exePath, const wchar_t* stringName, FFstrbuf* version) { - wchar_t exePathW[PATH_MAX]; + wchar_t exePathW[PATH_MAX + 1]; int len = MultiByteToWideChar(CP_UTF8, 0, exePath->chars, (int)exePath->length, exePathW, ARRAY_SIZE(exePathW)); if (len <= 0) return false; + assert(len < (int) ARRAY_SIZE(exePathW)); + exePathW[len] = L'\0'; return ffGetFileVersion(exePathW, stringName, version); }