André Hentschel : wininet: Test and fix possible error situations for InternetQueryOption with INTERNET_OPTION_PROXY .
Alexandre Julliard
julliard at winehq.org
Wed Aug 24 14:05:20 CDT 2011
Module: wine
Branch: master
Commit: 37cdf6bd2609690a42d7c7b8b47a5572290642d7
URL: http://source.winehq.org/git/wine.git/?a=commit;h=37cdf6bd2609690a42d7c7b8b47a5572290642d7
Author: André Hentschel <nerv at dawncrow.de>
Date: Tue Aug 23 21:01:44 2011 +0200
wininet: Test and fix possible error situations for InternetQueryOption with INTERNET_OPTION_PROXY.
---
dlls/wininet/internet.c | 1 +
dlls/wininet/tests/http.c | 21 +++++++++++++++++++++
2 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c
index cf555c7..79ec790 100644
--- a/dlls/wininet/internet.c
+++ b/dlls/wininet/internet.c
@@ -802,6 +802,7 @@ static DWORD APPINFO_QueryOption(object_header_t *hdr, DWORD option, void *buffe
}
case INTERNET_OPTION_PROXY:
+ if(!size) return ERROR_INVALID_PARAMETER;
if (unicode) {
INTERNET_PROXY_INFOW *pi = (INTERNET_PROXY_INFOW *)buffer;
DWORD proxyBytesRequired = 0, proxyBypassBytesRequired = 0;
diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c
index 2110dec..f3e85cb 100644
--- a/dlls/wininet/tests/http.c
+++ b/dlls/wininet/tests/http.c
@@ -2697,6 +2697,27 @@ static void test_options(int port)
ok(ret, "InternetQueryOption failed %u\n", GetLastError());
ok(ctx == 3, "expected 3 got %lu\n", ctx);
+ /* INTERNET_OPTION_PROXY */
+ SetLastError(0xdeadbeef);
+ ret = InternetQueryOptionA(ses, INTERNET_OPTION_PROXY, NULL, NULL);
+ error = GetLastError();
+ ok(!ret, "InternetQueryOption succeeded\n");
+ ok(error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %u\n", error);
+
+ SetLastError(0xdeadbeef);
+ ret = InternetQueryOptionA(ses, INTERNET_OPTION_PROXY, &ctx, NULL);
+ error = GetLastError();
+ ok(!ret, "InternetQueryOption succeeded\n");
+ ok(error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %u\n", error);
+
+ size = 0;
+ SetLastError(0xdeadbeef);
+ ret = InternetQueryOptionA(ses, INTERNET_OPTION_PROXY, NULL, &size);
+ error = GetLastError();
+ ok(!ret, "InternetQueryOption succeeded\n");
+ ok(error == ERROR_INSUFFICIENT_BUFFER, "expected ERROR_INSUFFICIENT_BUFFER, got %u\n", error);
+ ok(size >= sizeof(INTERNET_PROXY_INFOA), "expected size to be greater or equal to the struct size\n");
+
InternetCloseHandle(req);
InternetCloseHandle(con);
InternetCloseHandle(ses);
More information about the wine-cvs
mailing list