From 604e39dde5c189b6e35cc3205c34d3d8cb18a5f9 Mon Sep 17 00:00:00 2001 From: Juan Lang Date: Thu, 2 Sep 2010 18:31:23 -0700 Subject: [PATCH] crypt32: Add parameter checking to CryptSIPCreateIndirectData. --- dlls/crypt32/sip.c | 5 +++++ dlls/wintrust/tests/softpub.c | 13 ------------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/dlls/crypt32/sip.c b/dlls/crypt32/sip.c index e207457a7b7..d2f55f2ed00 100644 --- a/dlls/crypt32/sip.c +++ b/dlls/crypt32/sip.c @@ -715,6 +715,11 @@ BOOL WINAPI CryptSIPCreateIndirectData(SIP_SUBJECTINFO* pSubjectInfo, DWORD* pcb TRACE("(%p %p %p)\n", pSubjectInfo, pcbIndirectData, pIndirectData); + if (!pSubjectInfo || !pSubjectInfo->pgSubjectType || !pcbIndirectData) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } if ((sip = CRYPT_GetCachedSIP(pSubjectInfo->pgSubjectType))) ret = sip->info.pfCreate(pSubjectInfo, pcbIndirectData, pIndirectData); TRACE("returning %d\n", ret); diff --git a/dlls/wintrust/tests/softpub.c b/dlls/wintrust/tests/softpub.c index dd12000f617..b431ff84796 100644 --- a/dlls/wintrust/tests/softpub.c +++ b/dlls/wintrust/tests/softpub.c @@ -619,28 +619,17 @@ static void test_sip_create_indirect_data(void) skip("Missing CryptSIPCreateIndirectData\n"); return; } -if (0) -{ - /* FIXME: crashes Wine */ SetLastError(0xdeadbeef); ret = CryptSIPCreateIndirectData_p(NULL, NULL, NULL); - todo_wine ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); -} - /* FIXME: this assignment is only to avoid a crash in Wine, it isn't - * needed by native. - */ - subjinfo.pgSubjectType = &unknown; SetLastError(0xdeadbeef); ret = CryptSIPCreateIndirectData_p(&subjinfo, NULL, NULL); - todo_wine ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); subjinfo.cbSize = sizeof(subjinfo); SetLastError(0xdeadbeef); ret = CryptSIPCreateIndirectData_p(&subjinfo, NULL, NULL); - todo_wine ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); file = create_temp_file(temp_file); @@ -655,13 +644,11 @@ if (0) subjinfo.hFile = file; SetLastError(0xdeadbeef); ret = CryptSIPCreateIndirectData_p(&subjinfo, NULL, NULL); - todo_wine ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); subjinfo.pgSubjectType = &unknown; SetLastError(0xdeadbeef); ret = CryptSIPCreateIndirectData_p(&subjinfo, NULL, NULL); - todo_wine ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); count = 0xdeadbeef;