Module: wine Branch: master Commit: 2b384cb0e9f0b0ffd1e55d1a5106a41ad19fbff2 URL: http://source.winehq.org/git/wine.git/?a=commit;h=2b384cb0e9f0b0ffd1e55d1a51...
Author: Juan Lang juan.lang@gmail.com Date: Thu Dec 11 15:21:47 2008 -0800
crypt32: Validate input arguments to CryptQueryObject.
---
dlls/crypt32/object.c | 13 +++++++++++++ dlls/crypt32/tests/object.c | 2 -- 2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/dlls/crypt32/object.c b/dlls/crypt32/object.c index 825dad5..f6e0c84 100644 --- a/dlls/crypt32/object.c +++ b/dlls/crypt32/object.c @@ -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); diff --git a/dlls/crypt32/tests/object.c b/dlls/crypt32/tests/object.c index 6782cb0..23f3597 100644 --- a/dlls/crypt32/tests/object.c +++ b/dlls/crypt32/tests/object.c @@ -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 */