Signed-off-by: Ziqing Hui <zhui(a)codeweavers.com>
---
dlls/wininet/http.c | 6 ++++++
dlls/wininet/tests/http.c | 3 ---
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index 55698467cda..f6680790986 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -6139,6 +6139,12 @@ static DWORD HTTP_ProcessHeader(http_request_t *request, LPCWSTR field, LPCWSTR
{
HTTPHEADERW hdr;
+ if (!value[0])
+ {
+ LeaveCriticalSection(&request->headers_section);
+ return ERROR_INVALID_PARAMETER;
+ }
+
hdr.lpszField = (LPWSTR)field;
hdr.lpszValue = (LPWSTR)value;
hdr.wFlags = hdr.wCount = 0;
diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c
index ec576ae81e2..1cde6ea257c 100644
--- a/dlls/wininet/tests/http.c
+++ b/dlls/wininet/tests/http.c
@@ -2064,8 +2064,6 @@ static void HttpHeaders_test(void)
ok(GetLastError() == ERROR_HTTP_HEADER_NOT_FOUND, "got %lu\n", GetLastError());
/* Header with empty value should cause a failure */
- todo_wine
- {
SetLastError(0xdeadbeef);
ok(!HttpAddRequestHeadersA(hRequest, "EmptyTest1:", -1, HTTP_ADDREQ_FLAG_ADD), "Empty header should not be added.\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER, "Got unexpected error code %lu.\n", GetLastError());
@@ -2087,7 +2085,6 @@ static void HttpHeaders_test(void)
ok(!HttpQueryInfoA(hRequest, HTTP_QUERY_CUSTOM | HTTP_QUERY_FLAG_REQUEST_HEADERS, buffer, &len, NULL),
"Header with empty value is present.\n");
ok(GetLastError() == ERROR_HTTP_HEADER_NOT_FOUND, "Got unexpected error code %lu.\n", GetLastError());
- }
ok(InternetCloseHandle(hRequest), "Close request handle failed\n");
done:
--
2.25.1