Jacek Caban : wininet: Fixed handing NULL buffer in InternetReadFileExW.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue May 17 11:19:37 CDT 2016
Module: wine
Branch: master
Commit: f70c9ae8d147ac2f4377dae1f90eacf18d05df91
URL: http://source.winehq.org/git/wine.git/?a=commit;h=f70c9ae8d147ac2f4377dae1f90eacf18d05df91
Author: Jacek Caban <jacek at codeweavers.com>
Date: Mon May 16 22:42:19 2016 +0200
wininet: Fixed handing NULL buffer in InternetReadFileExW.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/wininet/internet.c | 2 +-
dlls/wininet/tests/http.c | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c
index 5359794..e192592 100644
--- a/dlls/wininet/internet.c
+++ b/dlls/wininet/internet.c
@@ -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;
}
diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c
index b4cad7d..78cec50 100644
--- a/dlls/wininet/tests/http.c
+++ b/dlls/wininet/tests/http.c
@@ -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;
More information about the wine-cvs
mailing list