utf16_to_utf8: Allocate space for converted string and NUL

References #6646
This commit is contained in:
James McCoy 2017-05-03 14:42:03 -04:00
parent 2b3cb2c448
commit 4f75e2f95c
No known key found for this signature in database
GPG Key ID: DFE691AE331BA3DB

View File

@ -1367,7 +1367,7 @@ int utf16_to_utf8(const WCHAR *strw, char **str)
return GetLastError();
}
*str = xmalloc(utf8_len);
*str = xmallocz(utf8_len);
// Convert to UTF-8.
utf8_len = WideCharToMultiByte(CP_UTF8,