kernelbase: Don't assume the length of the process image name.

NtQueryInformationProcess(ProcessImageFileNameWin32) may return an
empty string in some circumstances, which leads
QueryFullProcessImageNameW to crash if called with flags including
PROCESS_NAME_NATIVE, as that path assumed the image name had a length
of at least 2.
This commit is contained in:
Tim Clem 2022-08-09 13:10:15 -07:00 committed by Alexandre Julliard
parent 88f1d681c1
commit a7937e83b2

View file

@ -1575,7 +1575,7 @@ BOOL WINAPI DECLSPEC_HOTPATCH QueryFullProcessImageNameW( HANDLE process, DWORD
if (status) goto cleanup;
if (flags & PROCESS_NAME_NATIVE)
if (flags & PROCESS_NAME_NATIVE && result->Length > 2 * sizeof(WCHAR))
{
WCHAR drive[3];
WCHAR device[1024];