https://bugs.winehq.org/show_bug.cgi?id=49118
Bug ID: 49118 Summary: env.c:get_image_path() de-reference null pointer Product: Wine Version: 5.7 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: rich.coe2@gmail.com Distribution: ---
In the method dlls/ntdll/env.c:get_image_path() the call to RtlGetFullPathName_U() will set file_part pointer to null if it fails or full_name is a directory.
I found this when the path to the executable passed to wine was not parsing the spaces correctly.
diff --git a/dlls/ntdll/env.c b/dlls/ntdll/env.c index 71ae48681d..a89a62b893 100644 --- a/dlls/ntdll/env.c +++ b/dlls/ntdll/env.c @@ -707,6 +707,7 @@ static void get_image_path( const char *argv0, UNICODE_STRING *path ) { len = RtlGetFullPathName_U( name, sizeof(full_name), full_name, &file_part ); if (!len || len > sizeof(full_name)) goto failed; + if (NULL == file_part) goto failed; /* try first without extension */ if (RtlDoesFileExists_U( full_name )) goto done; if (len < (MAX_PATH - 4) * sizeof(WCHAR) && !wcschr( file_part, '.' ))