wininet: Fixed handing NULL buffer in InternetReadFileExW.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2016-05-16 22:42:19 +02:00 committed by Alexandre Julliard
parent cebb5d3066
commit f70c9ae8d1
2 changed files with 6 additions and 1 deletions

View File

@ -2280,7 +2280,7 @@ BOOL WINAPI InternetReadFileExW(HINTERNET hFile, LPINTERNET_BUFFERSW lpBuffer,
TRACE("(%p %p 0x%x 0x%lx)\n", hFile, lpBuffer, dwFlags, dwContext);
if (lpBuffer->dwStructSize != sizeof(*lpBuffer)) {
if (!lpBuffer || lpBuffer->dwStructSize != sizeof(*lpBuffer)) {
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}

View File

@ -1067,6 +1067,11 @@ static void InternetReadFileExA_test(int flags)
CLEAR_NOTIFIED(INTERNET_STATUS_CONNECTING_TO_SERVER);
CLEAR_NOTIFIED(INTERNET_STATUS_CONNECTED_TO_SERVER);
rc = InternetReadFileExW(hor, NULL, 0, 0xdeadcafe);
ok(!rc && (GetLastError() == ERROR_INVALID_PARAMETER),
"InternetReadFileEx should have failed with ERROR_INVALID_PARAMETER instead of %s, %u\n",
rc ? "TRUE" : "FALSE", GetLastError());
/* tests invalid dwStructSize */
inetbuffers.dwStructSize = sizeof(inetbuffers)+1;
inetbuffers.lpcszHeader = NULL;