Juan Lang : crypt32: Add parameter checking to CryptSIPCreateIndirectData.

Alexandre Julliard julliard at winehq.org
Fri Sep 24 11:43:46 CDT 2010


Module: wine
Branch: master
Commit: 604e39dde5c189b6e35cc3205c34d3d8cb18a5f9
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=604e39dde5c189b6e35cc3205c34d3d8cb18a5f9

Author: Juan Lang <juan.lang at gmail.com>
Date:   Thu Sep  2 18:31:23 2010 -0700

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 e207457..d2f55f2 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 dd12000..b431ff8 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;




More information about the wine-cvs mailing list