The HTTP response header status text can be empty, so process_response_status_text would erroneously return E_OUTOFMEMORY.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/mshtml/mshtml_private.h | 6 +++--- dlls/wininet/tests/http.c | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index ad1fca0..0a7c3a2 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -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'; } } diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c index ec576ae..bc1b829 100644 --- a/dlls/wininet/tests/http.c +++ b/dlls/wininet/tests/http.c @@ -4526,6 +4526,13 @@ static const http_status_test_t http_status_tests[] = { 200, "" }, + { + "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"