Update miniz_zip.c

Bugfix: MultiByteToWideChar() is being called with a byte count instead of a character count. This will cause a buffer overrun.
This commit is contained in:
jpcha2 2022-11-21 04:36:20 +03:00 committed by GitHub
parent 963a27a112
commit 78e9404362
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,7 +48,7 @@ static WCHAR* mz_utf8z_to_widechar(const char* str)
{
int reqChars = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0);
WCHAR* wStr = (WCHAR*)malloc(reqChars * sizeof(WCHAR));
MultiByteToWideChar(CP_UTF8, 0, str, -1, wStr, sizeof(WCHAR) * reqChars);
MultiByteToWideChar(CP_UTF8, 0, str, -1, wStr, reqChars);
return wStr;
}