mirror of
https://github.com/ValveSoftware/Proton.git
synced 2025-07-20 12:16:24 +03:00
steam_helper: Null terminate escape_path_unix_to_dos.
WideCharToMultiByte does not null terminate if a null character is not included in the input length. CW-Bug-Id: #24534
This commit is contained in:
parent
0b31734416
commit
340027e317
@ -115,7 +115,11 @@ static char *escape_path_unix_to_dos( const char *path )
|
||||
for (src = dos, dst = tmp; *src; src++, dst++) if ((*dst = *src) == '\\') *++dst = '\\';
|
||||
|
||||
if (!(len = WideCharToMultiByte( CP_UTF8, 0, tmp, (dst - tmp), NULL, 0, NULL, NULL ))) goto done;
|
||||
if ((escaped = malloc( len ))) WideCharToMultiByte( CP_UTF8, 0, tmp, (dst - tmp), escaped, len, NULL, NULL );
|
||||
if ((escaped = malloc( len + 1 )))
|
||||
{
|
||||
WideCharToMultiByte( CP_UTF8, 0, tmp, (dst - tmp), escaped, len, NULL, NULL );
|
||||
escaped[len] = '\0';
|
||||
}
|
||||
|
||||
done:
|
||||
HeapFree( GetProcessHeap(), 0, dos );
|
||||
|
Loading…
x
Reference in New Issue
Block a user