Commit 2e21d090 authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

wininet: Cope with non-nul-terminated header strings being passed to HttpSendRequestW.

parent 4d1b8b1a
...@@ -2224,8 +2224,8 @@ BOOL WINAPI HttpSendRequestW(HINTERNET hHttpRequest, LPCWSTR lpszHeaders, ...@@ -2224,8 +2224,8 @@ BOOL WINAPI HttpSendRequestW(HINTERNET hHttpRequest, LPCWSTR lpszHeaders,
LPWININETAPPINFOW hIC = NULL; LPWININETAPPINFOW hIC = NULL;
BOOL r; BOOL r;
TRACE("%p, %p (%s), %i, %p, %i)\n", hHttpRequest, TRACE("%p, %s, %i, %p, %i)\n", hHttpRequest,
lpszHeaders, debugstr_w(lpszHeaders), dwHeaderLength, lpOptional, dwOptionalLength); debugstr_wn(lpszHeaders, dwHeaderLength), dwHeaderLength, lpOptional, dwOptionalLength);
lpwhr = (LPWININETHTTPREQW) WININET_GetObject( hHttpRequest ); lpwhr = (LPWININETHTTPREQW) WININET_GetObject( hHttpRequest );
if (NULL == lpwhr || lpwhr->hdr.htype != WH_HHTTPREQ) if (NULL == lpwhr || lpwhr->hdr.htype != WH_HHTTPREQ)
...@@ -2260,7 +2260,10 @@ BOOL WINAPI HttpSendRequestW(HINTERNET hHttpRequest, LPCWSTR lpszHeaders, ...@@ -2260,7 +2260,10 @@ BOOL WINAPI HttpSendRequestW(HINTERNET hHttpRequest, LPCWSTR lpszHeaders,
workRequest.hdr = WININET_AddRef( &lpwhr->hdr ); workRequest.hdr = WININET_AddRef( &lpwhr->hdr );
req = &workRequest.u.HttpSendRequestW; req = &workRequest.u.HttpSendRequestW;
if (lpszHeaders) if (lpszHeaders)
req->lpszHeader = WININET_strdupW(lpszHeaders); {
req->lpszHeader = HeapAlloc(GetProcessHeap(), 0, dwHeaderLength * sizeof(WCHAR));
memcpy(req->lpszHeader, lpszHeaders, dwHeaderLength * sizeof(WCHAR));
}
else else
req->lpszHeader = 0; req->lpszHeader = 0;
req->dwHeaderLength = dwHeaderLength; req->dwHeaderLength = dwHeaderLength;
......
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