Commit cf1bbb3b authored by Marcus Meissner's avatar Marcus Meissner Committed by Alexandre Julliard

crypt32: Avoid NULL ptr dereferences before checks (Coverity).

parent eeefed3d
...@@ -341,7 +341,7 @@ PCCTL_CONTEXT WINAPI CertFindCTLInStore(HCERTSTORE hCertStore, ...@@ -341,7 +341,7 @@ PCCTL_CONTEXT WINAPI CertFindCTLInStore(HCERTSTORE hCertStore,
BOOL WINAPI CertDeleteCTLFromStore(PCCTL_CONTEXT pCtlContext) BOOL WINAPI CertDeleteCTLFromStore(PCCTL_CONTEXT pCtlContext)
{ {
WINECRYPT_CERTSTORE *hcs = pCtlContext->hCertStore; WINECRYPT_CERTSTORE *hcs;
ctl_t *ctl = ctl_from_ptr(pCtlContext); ctl_t *ctl = ctl_from_ptr(pCtlContext);
BOOL ret; BOOL ret;
...@@ -350,6 +350,8 @@ BOOL WINAPI CertDeleteCTLFromStore(PCCTL_CONTEXT pCtlContext) ...@@ -350,6 +350,8 @@ BOOL WINAPI CertDeleteCTLFromStore(PCCTL_CONTEXT pCtlContext)
if (!pCtlContext) if (!pCtlContext)
return TRUE; return TRUE;
hcs = pCtlContext->hCertStore;
if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC) if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC)
return FALSE; return FALSE;
......
...@@ -949,13 +949,15 @@ PCCERT_CONTEXT WINAPI CertEnumCertificatesInStore(HCERTSTORE hCertStore, PCCERT_ ...@@ -949,13 +949,15 @@ PCCERT_CONTEXT WINAPI CertEnumCertificatesInStore(HCERTSTORE hCertStore, PCCERT_
BOOL WINAPI CertDeleteCertificateFromStore(PCCERT_CONTEXT pCertContext) BOOL WINAPI CertDeleteCertificateFromStore(PCCERT_CONTEXT pCertContext)
{ {
WINECRYPT_CERTSTORE *hcs = pCertContext->hCertStore; WINECRYPT_CERTSTORE *hcs;
TRACE("(%p)\n", pCertContext); TRACE("(%p)\n", pCertContext);
if (!pCertContext) if (!pCertContext)
return TRUE; return TRUE;
hcs = pCertContext->hCertStore;
if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC) if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC)
return FALSE; return FALSE;
...@@ -1084,7 +1086,7 @@ BOOL WINAPI CertAddCRLContextToStore(HCERTSTORE hCertStore, ...@@ -1084,7 +1086,7 @@ BOOL WINAPI CertAddCRLContextToStore(HCERTSTORE hCertStore,
BOOL WINAPI CertDeleteCRLFromStore(PCCRL_CONTEXT pCrlContext) BOOL WINAPI CertDeleteCRLFromStore(PCCRL_CONTEXT pCrlContext)
{ {
WINECRYPT_CERTSTORE *hcs = pCrlContext->hCertStore; WINECRYPT_CERTSTORE *hcs;
BOOL ret; BOOL ret;
TRACE("(%p)\n", pCrlContext); TRACE("(%p)\n", pCrlContext);
...@@ -1092,6 +1094,8 @@ BOOL WINAPI CertDeleteCRLFromStore(PCCRL_CONTEXT pCrlContext) ...@@ -1092,6 +1094,8 @@ BOOL WINAPI CertDeleteCRLFromStore(PCCRL_CONTEXT pCrlContext)
if (!pCrlContext) if (!pCrlContext)
return TRUE; return TRUE;
hcs = pCrlContext->hCertStore;
if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC) if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC)
return FALSE; return FALSE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment