mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-15 19:19:58 -04:00
Check the length of LOCALAPPDATA in the setup before appending to it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -373,7 +373,9 @@ int WINAPI wWinMain(HINSTANCE inst, HINSTANCE prev, PWSTR cmdline, int show)
|
||||
if (!S.dest[0]) {
|
||||
wchar_t base[PATHN];
|
||||
if (!known_folder(&FOLDERID_UserProgramFiles, base, PATHN)) {
|
||||
if (!GetEnvironmentVariableW(L"LOCALAPPDATA", base, PATHN)) return 1;
|
||||
// 0 when unset; PATHN or more when it does not fit (base is then left unwritten); room for \Programs
|
||||
DWORD got = GetEnvironmentVariableW(L"LOCALAPPDATA", base, PATHN);
|
||||
if (!got || got >= PATHN - 16) return 1;
|
||||
wcscat(base, L"\\Programs");
|
||||
}
|
||||
swprintf(S.dest, PATHN, L"%ls\\%ls", base, APP_NAME);
|
||||
|
||||
Reference in New Issue
Block a user