Skip to content

Commit f34d51d

Browse files
committed
Terminal (Windows): fix file version detection
1 parent e05ac79 commit f34d51d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/detection/terminalshell/terminalshell.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@
2222

2323
static bool getFileVersion(const FFstrbuf* exePath, const wchar_t* stringName, FFstrbuf* version)
2424
{
25-
wchar_t exePathW[PATH_MAX];
25+
wchar_t exePathW[PATH_MAX + 1];
2626
int len = MultiByteToWideChar(CP_UTF8, 0, exePath->chars, (int)exePath->length, exePathW, ARRAY_SIZE(exePathW));
2727
if (len <= 0) return false;
28+
assert(len < (int) ARRAY_SIZE(exePathW));
29+
exePathW[len] = L'\0';
2830
return ffGetFileVersion(exePathW, stringName, version);
2931
}
3032

0 commit comments

Comments
 (0)