Commit 4990ca0e authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

wininet: Avoid a crash on NULL lpcszHeader in HttpSendRequestExW.

parent bd4bc161
...@@ -3338,8 +3338,10 @@ BOOL WINAPI HttpSendRequestExW(HINTERNET hRequest, ...@@ -3338,8 +3338,10 @@ BOOL WINAPI HttpSendRequestExW(HINTERNET hRequest,
req = &workRequest.u.HttpSendRequestW; req = &workRequest.u.HttpSendRequestW;
if (lpBuffersIn) if (lpBuffersIn)
{ {
DWORD size; DWORD size = 0;
if (lpBuffersIn->lpcszHeader)
{
if (lpBuffersIn->dwHeadersLength == ~0u) if (lpBuffersIn->dwHeadersLength == ~0u)
size = (strlenW( lpBuffersIn->lpcszHeader ) + 1) * sizeof(WCHAR); size = (strlenW( lpBuffersIn->lpcszHeader ) + 1) * sizeof(WCHAR);
else else
...@@ -3347,8 +3349,10 @@ BOOL WINAPI HttpSendRequestExW(HINTERNET hRequest, ...@@ -3347,8 +3349,10 @@ BOOL WINAPI HttpSendRequestExW(HINTERNET hRequest,
req->lpszHeader = HeapAlloc( GetProcessHeap(), 0, size ); req->lpszHeader = HeapAlloc( GetProcessHeap(), 0, size );
memcpy( req->lpszHeader, lpBuffersIn->lpcszHeader, size ); memcpy( req->lpszHeader, lpBuffersIn->lpcszHeader, size );
}
else req->lpszHeader = NULL;
req->dwHeaderLength = lpBuffersIn->dwHeadersLength; req->dwHeaderLength = size / sizeof(WCHAR);
req->lpOptional = lpBuffersIn->lpvBuffer; req->lpOptional = lpBuffersIn->lpvBuffer;
req->dwOptionalLength = lpBuffersIn->dwBufferLength; req->dwOptionalLength = lpBuffersIn->dwBufferLength;
req->dwContentLength = lpBuffersIn->dwBufferTotal; req->dwContentLength = lpBuffersIn->dwBufferTotal;
......
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