Commit f1c57f06 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

shell32: Avoid stack corruption with long name in SHELL_TryAppPathW().

parent 94e3e2d1
......@@ -428,8 +428,14 @@ static BOOL SHELL_TryAppPathW( LPCWSTR szName, LPWSTR lpResult, WCHAR **env)
BOOL found = FALSE;
if (env) *env = NULL;
lstrcpyW(buffer, L"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\");
lstrcatW(buffer, szName);
wcscpy(buffer, L"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\");
if (wcslen(buffer) + wcslen(szName) + 1 > ARRAY_SIZE(buffer))
{
WARN("Name is too big.\n");
return FALSE;
}
wcscat(buffer, szName);
res = RegOpenKeyExW(HKEY_LOCAL_MACHINE, buffer, 0, KEY_READ, &hkApp);
if (res) goto end;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment