wininet: Handle NULL req->netconn in INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT query.

This commit is contained in:
Piotr Caban 2013-05-03 15:19:22 +02:00 committed by Alexandre Julliard
parent dd35601b07
commit 33d62f3f17
2 changed files with 10 additions and 0 deletions

View File

@ -2125,6 +2125,9 @@ static DWORD HTTPREQ_QueryOption(object_header_t *hdr, DWORD option, void *buffe
case INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT: {
PCCERT_CONTEXT context;
if(!req->netconn)
return ERROR_INTERNET_INVALID_OPERATION;
if(*size < sizeof(INTERNET_CERTIFICATE_INFOA)) {
*size = sizeof(INTERNET_CERTIFICATE_INFOA);
return ERROR_INSUFFICIENT_BUFFER;

View File

@ -3354,6 +3354,13 @@ static void test_options(int port)
ret = InternetQueryOption(req, INTERNET_OPTION_DIAGNOSTIC_SOCKET_INFO, &idsi, &size);
ok(ret, "InternetQueryOption failed %u\n", GetLastError());
size = 0;
SetLastError(0xdeadbeef);
ret = InternetQueryOption(req, INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT, NULL, &size);
error = GetLastError();
ok(!ret, "InternetQueryOption succeeded\n");
ok(error == ERROR_INTERNET_INVALID_OPERATION, "expected ERROR_INTERNET_INVALID_OPERATION, got %u\n", error);
/* INTERNET_OPTION_PROXY */
SetLastError(0xdeadbeef);
ret = InternetQueryOptionA(ses, INTERNET_OPTION_PROXY, NULL, NULL);