Commit 239b5726 authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

mshtml: Handle empty strings in heap_strndupWtoU.

The HTTP response header status text can be empty, so process_response_status_text would erroneously return E_OUTOFMEMORY. Signed-off-by: 's avatarGabriel Ivăncescu <gabrielopcode@gmail.com> Signed-off-by: 's avatarJacek Caban <jacek@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 7d7d1662
......@@ -1392,11 +1392,11 @@ static inline char *heap_strndupWtoU(LPCWSTR str, unsigned len)
char *ret = NULL;
DWORD size;
if(str && len) {
size = WideCharToMultiByte(CP_UTF8, 0, str, len, NULL, 0, NULL, NULL);
if(str) {
size = len ? WideCharToMultiByte(CP_UTF8, 0, str, len, NULL, 0, NULL, NULL) : 0;
ret = heap_alloc(size + 1);
if(ret) {
WideCharToMultiByte(CP_UTF8, 0, str, len, ret, size, NULL, NULL);
if(len) WideCharToMultiByte(CP_UTF8, 0, str, len, ret, size, NULL, NULL);
ret[size] = '\0';
}
}
......
......@@ -4527,6 +4527,13 @@ static const http_status_test_t http_status_tests[] = {
""
},
{
"HTTP/1.1 200 \r\n"
"Content-Length: 1\r\n"
"\r\nx",
200,
""
},
{
"HTTP/1.1 410 \r\n"
"Content-Length: 1\r\n"
"\r\nx",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment