[PATCH v3 0/1] MR8455: kernel32: Update len in the absolute path case.
Fixes: 96cd811903e3d3f227c39e12235725baf793f4b9 -- v3: kernel32: Use the correct buffer length. https://gitlab.winehq.org/wine/wine/-/merge_requests/8455
From: Huw Davies <huw(a)codeweavers.com> Fixes: 96cd811903e3d3f227c39e12235725baf793f4b9 --- dlls/kernel32/path.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c index b6fa4497538..19871f3764f 100644 --- a/dlls/kernel32/path.c +++ b/dlls/kernel32/path.c @@ -438,7 +438,6 @@ WCHAR * CDECL wine_get_dos_file_name( LPCSTR str ) status = RtlDosPathNameToNtPathName_U_WithStatus( buffer, &nt_name, NULL, NULL ); if (!set_ntstatus( status )) goto failed; buffer = nt_name.Buffer; - len = nt_name.Length / sizeof(WCHAR) + 1; } else { @@ -472,7 +471,7 @@ WCHAR * CDECL wine_get_dos_file_name( LPCSTR str ) { /* get rid of the \??\ prefix */ /* FIXME: should implement RtlNtPathNameToDosPathName and use that instead */ - memmove( buffer, buffer + 4, (len - 4) * sizeof(WCHAR) ); + memmove( buffer, buffer + 4, (wcslen(buffer + 4) + 1) * sizeof(WCHAR) ); } else buffer[1] = '\\'; return buffer; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/8455
Found this after filing https://bugs.winehq.org/show_bug.cgi?id=58435, currently testing the patch. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/8455#note_108395
This merge request was approved by William Horvath. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/8455
Confirmed this patch fixes the observed behavior. Thanks, Huw. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/8455#note_108404
participants (4)
-
Esme Povirk (@madewokherd) -
Huw Davies -
Huw Davies (@huw) -
William Horvath (@whrvt)