wintrust(2/2): Check for the presence of required members of WINTRUST_CERT_INFO rather than requiring callers to be compiled with the same SDK version

Juan Lang juan.lang at gmail.com
Fri Jun 12 11:42:24 CDT 2009


--Juan
-------------- next part --------------
From cd9eddce1dfbc076cbeede6b168b8d9ab34f2b49 Mon Sep 17 00:00:00 2001
From: Juan Lang <juan.lang at gmail.com>
Date: Fri, 12 Jun 2009 09:35:41 -0700
Subject: [PATCH 2/2] Check for the presence of required members of WINTRUST_CERT_INFO rather
 than requiring callers to be compiled with the same SDK version

---
 dlls/wintrust/softpub.c |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/dlls/wintrust/softpub.c b/dlls/wintrust/softpub.c
index 9c79fa8..7f5f86f 100644
--- a/dlls/wintrust/softpub.c
+++ b/dlls/wintrust/softpub.c
@@ -256,7 +256,8 @@ static BOOL SOFTPUB_LoadCertMessage(CRYPT_PROVIDER_DATA *data)
     BOOL ret;
 
     if (data->pWintrustData->u.pCert &&
-     data->pWintrustData->u.pCert->cbStruct == sizeof(WINTRUST_CERT_INFO))
+     WVT_IS_CBSTRUCT_GT_MEMBEROFFSET(WINTRUST_CERT_INFO,
+     data->pWintrustData->u.pCert->cbStruct, psCertContext))
     {
         if (data->psPfns)
         {
@@ -266,7 +267,9 @@ static BOOL SOFTPUB_LoadCertMessage(CRYPT_PROVIDER_DATA *data)
             /* Add a signer with nothing but the time to verify, so we can
              * add a cert to it
              */
-            if (data->pWintrustData->u.pCert->psftVerifyAsOf)
+            if (WVT_ISINSTRUCT(WINTRUST_CERT_INFO,
+             data->pWintrustData->u.pCert->cbStruct, psftVerifyAsOf) &&
+             data->pWintrustData->u.pCert->psftVerifyAsOf)
                 data->sftSystemTime = signer.sftVerifyAsOf;
             else
             {
@@ -280,10 +283,12 @@ static BOOL SOFTPUB_LoadCertMessage(CRYPT_PROVIDER_DATA *data)
             {
                 ret = data->psPfns->pfnAddCert2Chain(data, 0, FALSE, 0,
                  data->pWintrustData->u.pCert->psCertContext);
-                for (i = 0; ret && i < data->pWintrustData->u.pCert->chStores;
-                 i++)
-                    ret = data->psPfns->pfnAddStore2Chain(data,
-                     data->pWintrustData->u.pCert->pahStores[i]);
+                if (WVT_ISINSTRUCT(WINTRUST_CERT_INFO,
+                 data->pWintrustData->u.pCert->cbStruct, pahStores))
+                        for (i = 0;
+                         ret && i < data->pWintrustData->u.pCert->chStores; i++)
+                            ret = data->psPfns->pfnAddStore2Chain(data,
+                             data->pWintrustData->u.pCert->pahStores[i]);
             }
         }
         else
-- 
1.6.3.2


More information about the wine-patches mailing list