diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c index c3e68ce181b..feb25bbc0c5 100644 --- a/dlls/wininet/internet.c +++ b/dlls/wininet/internet.c @@ -1085,6 +1085,11 @@ BOOL WINAPI InternetGetLastResponseInfoA(LPDWORD lpdwError, TRACE("(%p, %p, %p)\n", lpdwError, lpszBuffer, lpdwBufferLength); + if (!lpdwError || !lpdwBufferLength) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } if (lpwite) { *lpdwError = lpwite->dwError; @@ -1122,6 +1127,11 @@ BOOL WINAPI InternetGetLastResponseInfoW(LPDWORD lpdwError, TRACE("(%p, %p, %p)\n", lpdwError, lpszBuffer, lpdwBufferLength); + if (!lpdwError || !lpdwBufferLength) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } if (lpwite) { *lpdwError = lpwite->dwError; diff --git a/dlls/wininet/tests/ftp.c b/dlls/wininet/tests/ftp.c index c6d972a3523..eba7c180939 100644 --- a/dlls/wininet/tests/ftp.c +++ b/dlls/wininet/tests/ftp.c @@ -738,12 +738,19 @@ static void test_command(HINTERNET hFtp) for (i = 0; i < ARRAY_SIZE(command_test); i++) { + DWORD size; + SetLastError(0xdeadbeef); ret = pFtpCommandA(hFtp, FALSE, FTP_TRANSFER_TYPE_ASCII, command_test[i].cmd, 0, NULL); error = GetLastError(); ok(ret == command_test[i].ret, "%d: expected FtpCommandA to %s\n", i, command_test[i].ret ? "succeed" : "fail"); ok(error == command_test[i].error, "%d: expected error %u, got %u\n", i, command_test[i].error, error); + + ret = InternetGetLastResponseInfoA(&error, NULL, NULL); + ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "%d: ret %d, lasterr %d\n", i, ret, GetLastError()); + ret = InternetGetLastResponseInfoA(NULL, NULL, &size); + ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "%d: ret %d, lasterr %d\n", i, ret, GetLastError()); } }