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

This commit is contained in:
Juan Lang 2009-06-12 09:35:41 -07:00 committed by Alexandre Julliard
parent abacfc0f45
commit 9da4d2f3a9
1 changed files with 11 additions and 6 deletions

View File

@ -256,7 +256,8 @@ static BOOL SOFTPUB_LoadCertMessage(CRYPT_PROVIDER_DATA *data)
BOOL ret; BOOL ret;
if (data->pWintrustData->u.pCert && 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) 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 signer with nothing but the time to verify, so we can
* add a cert to it * 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; data->sftSystemTime = signer.sftVerifyAsOf;
else else
{ {
@ -280,10 +283,12 @@ static BOOL SOFTPUB_LoadCertMessage(CRYPT_PROVIDER_DATA *data)
{ {
ret = data->psPfns->pfnAddCert2Chain(data, 0, FALSE, 0, ret = data->psPfns->pfnAddCert2Chain(data, 0, FALSE, 0,
data->pWintrustData->u.pCert->psCertContext); data->pWintrustData->u.pCert->psCertContext);
for (i = 0; ret && i < data->pWintrustData->u.pCert->chStores; if (WVT_ISINSTRUCT(WINTRUST_CERT_INFO,
i++) data->pWintrustData->u.pCert->cbStruct, pahStores))
ret = data->psPfns->pfnAddStore2Chain(data, for (i = 0;
data->pWintrustData->u.pCert->pahStores[i]); ret && i < data->pWintrustData->u.pCert->chStores; i++)
ret = data->psPfns->pfnAddStore2Chain(data,
data->pWintrustData->u.pCert->pahStores[i]);
} }
} }
else else