winmm: Always allocate at least MAX_PATH bytes in mmioOpenW().

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2020-12-17 16:40:48 -06:00 committed by Alexandre Julliard
parent 8a22d28766
commit b9407f75ef
1 changed files with 1 additions and 0 deletions

View File

@ -734,6 +734,7 @@ HMMIO WINAPI mmioOpenW(LPWSTR szFileName, MMIOINFO* lpmmioinfo,
if (szFileName) if (szFileName)
{ {
INT len = WideCharToMultiByte( CP_ACP, 0, szFileName, -1, NULL, 0, NULL, NULL ); INT len = WideCharToMultiByte( CP_ACP, 0, szFileName, -1, NULL, 0, NULL, NULL );
if (len < MAX_PATH) len = MAX_PATH;
szFn = HeapAlloc( GetProcessHeap(), 0, len ); szFn = HeapAlloc( GetProcessHeap(), 0, len );
if (!szFn) return NULL; if (!szFn) return NULL;
WideCharToMultiByte( CP_ACP, 0, szFileName, -1, szFn, len, NULL, NULL ); WideCharToMultiByte( CP_ACP, 0, szFileName, -1, szFn, len, NULL, NULL );