[PATCH 2/2] uninstaller: Allocate enough memory to null-terminate the command string

Alexandre Julliard julliard at winehq.org
Mon May 15 04:17:47 CDT 2017


Hugh McMaster <hugh.mcmaster at outlook.com> writes:

> @@ -245,7 +245,7 @@ static int FetchFromRootKey(HKEY root)
>                  type == REG_DWORD && value == 1)
>              {
>                  static const WCHAR fmtW[] = {'m','s','i','e','x','e','c',' ','/','x','%','s',0};
> -                command = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(fmtW) + lstrlenW(subKeyName)) * sizeof(WCHAR));
> +                command = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(fmtW) + sizeOfSubKeyName + 1) * sizeof(WCHAR));

The %s in the format gets replaced, so the existing code is fine.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list