Module: wine
Branch: oldstable
Commit: 67c81ef39e5a22c89da7bc56cb3872ac6a1dc6a1
URL: https://gitlab.winehq.org/wine/wine/-/commit/67c81ef39e5a22c89da7bc56cb3872…
Author: Tim Clem <tclem(a)codeweavers.com>
Date: Tue Aug 9 13:10:15 2022 -0700
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.
(cherry picked from commit a7937e83b2f8606aa777098eb5e738241a5458e1)
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/kernelbase/debug.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/kernelbase/debug.c b/dlls/kernelbase/debug.c
index 45bb6c019e9..450cb33ce8e 100644
--- a/dlls/kernelbase/debug.c
+++ b/dlls/kernelbase/debug.c
@@ -1567,7 +1567,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];