crypt32: Validate input arguments to CryptQueryObject.

This commit is contained in:
Juan Lang 2008-12-11 15:21:47 -08:00 committed by Alexandre Julliard
parent 351ebcae25
commit 2b384cb0e9
2 changed files with 13 additions and 2 deletions

View File

@ -492,6 +492,19 @@ BOOL WINAPI CryptQueryObject(DWORD dwObjectType, const void *pvObject,
dwExpectedFormatTypeFlags, dwFlags, pdwMsgAndCertEncodingType,
pdwContentType, pdwFormatType, phCertStore, phMsg, ppvContext);
if (dwObjectType != CERT_QUERY_OBJECT_BLOB &&
dwObjectType != CERT_QUERY_OBJECT_FILE)
{
WARN("unsupported type %d\n", dwObjectType);
SetLastError(E_INVALIDARG);
return FALSE;
}
if (!pvObject)
{
WARN("missing required argument\n");
SetLastError(E_INVALIDARG);
return FALSE;
}
if (dwExpectedContentTypeFlags & unimplementedTypes)
WARN("unimplemented for types %08x\n",
dwExpectedContentTypeFlags & unimplementedTypes);

View File

@ -130,13 +130,11 @@ static void test_query_object(void)
SetLastError(0xdeadbeef);
ret = CryptQueryObject(0, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, NULL,
NULL);
todo_wine
ok(!ret && GetLastError() == E_INVALIDARG,
"expected E_INVALIDARG, got %08x\n", GetLastError());
SetLastError(0xdeadbeef);
ret = CryptQueryObject(CERT_QUERY_OBJECT_BLOB, NULL, 0, 0, 0, NULL, NULL,
NULL, NULL, NULL, NULL);
todo_wine
ok(!ret && GetLastError() == E_INVALIDARG,
"expected E_INVALIDARG, got %08x\n", GetLastError());
/* Test with a simple cert */