Juan Lang : crypt32: Validate add disposition before checking source certificate's properties.

Alexandre Julliard julliard at winehq.org
Mon May 17 09:39:26 CDT 2010


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

Author: Juan Lang <juan.lang at gmail.com>
Date:   Fri May 14 13:49:44 2010 -0700

crypt32: Validate add disposition before checking source certificate's properties.

---

 dlls/crypt32/store.c |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/dlls/crypt32/store.c b/dlls/crypt32/store.c
index a892394..da3de56 100644
--- a/dlls/crypt32/store.c
+++ b/dlls/crypt32/store.c
@@ -855,7 +855,16 @@ BOOL WINAPI CertAddCertificateContextToStore(HCERTSTORE hCertStore,
     TRACE("(%p, %p, %08x, %p)\n", hCertStore, pCertContext,
      dwAddDisposition, ppStoreContext);
 
-    if (dwAddDisposition != CERT_STORE_ADD_ALWAYS)
+    switch (dwAddDisposition)
+    {
+    case CERT_STORE_ADD_ALWAYS:
+        break;
+    case CERT_STORE_ADD_NEW:
+    case CERT_STORE_ADD_REPLACE_EXISTING:
+    case CERT_STORE_ADD_REPLACE_EXISTING_INHERIT_PROPERTIES:
+    case CERT_STORE_ADD_USE_EXISTING:
+    case CERT_STORE_ADD_NEWER:
+    case CERT_STORE_ADD_NEWER_INHERIT_PROPERTIES:
     {
         BYTE hashToAdd[20];
         DWORD size = sizeof(hashToAdd);
@@ -870,6 +879,12 @@ BOOL WINAPI CertAddCertificateContextToStore(HCERTSTORE hCertStore,
              pCertContext->dwCertEncodingType, 0, CERT_FIND_SHA1_HASH, &blob,
              NULL);
         }
+        break;
+    }
+    default:
+        FIXME("Unimplemented add disposition %d\n", dwAddDisposition);
+        SetLastError(E_INVALIDARG);
+        ret = FALSE;
     }
 
     switch (dwAddDisposition)
@@ -940,10 +955,6 @@ BOOL WINAPI CertAddCertificateContextToStore(HCERTSTORE hCertStore,
         else
             toAdd = CertDuplicateCertificateContext(pCertContext);
         break;
-    default:
-        FIXME("Unimplemented add disposition %d\n", dwAddDisposition);
-        SetLastError(E_INVALIDARG);
-        ret = FALSE;
     }
 
     if (toAdd)




More information about the wine-cvs mailing list