[MSI] Don't write past end of string when selecting parent directory (#6335)

Import Wine commit: bbce5d014d

Since there's not really something sensible to do in the
"path contains no backslashes" case (adding a backslash seems pointless),
move PathAddBackslashW call inside the if condition to avoid the crash.
Fix suggested by Thomas Faber.

This fixes heap assert in msi/dialog.c when installing Tortoise GIT.
CORE-16693

Co-authored-by: Thomas Faber <thomas.faber@reactos.org>
Co-authored-by: Fabian Maurer <dark.shadow4@web.de>
This commit is contained in:
Doug Lyons 2024-02-06 14:20:57 -06:00 committed by GitHub
parent 0bce79a50b
commit 2bc44bf95c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 3 deletions

View file

@ -2943,8 +2943,11 @@ static UINT msi_dialog_directorylist_up( msi_dialog *dialog )
/* strip off the last directory */
ptr = PathFindFileNameW( path );
if (ptr != path) *(ptr - 1) = '\0';
PathAddBackslashW( path );
if (ptr != path)
{
*(ptr - 1) = '\0';
PathAddBackslashW( path );
}
msi_dialog_set_property( dialog->package, prop, path );

View file

@ -115,7 +115,7 @@ dll/win32/msg711.acm # Synced to WineStaging-4.18
dll/win32/msgsm32.acm # Synced to WineStaging-4.0
dll/win32/mshtml # Synced to WineStaging-1.7.55
dll/win32/mshtml.tlb # Synced to WineStaging-1.7.55
dll/win32/msi # Synced to WineStaging-7.3
dll/win32/msi # Synced to WineStaging-7.3 (+ dialog.c synced to bbce5d014db7f023b133d6d09e6846e027586f7d)
dll/win32/msimg32 # Synced to WineStaging-3.3
dll/win32/msimtf # Synced to WineStaging-4.18
dll/win32/msisip # Synced to WineStaging-4.18