[PATCH] crypt32: avoid NULL ptr dereferences before checks (Coverity)
Marcus Meissner
marcus at jet.franken.de
Sat Oct 26 03:33:23 CDT 2013
1112863 Dereference before null check
1112864 Dereference before null check
1112865 Dereference before null check
---
dlls/crypt32/ctl.c | 4 +++-
dlls/crypt32/store.c | 8 ++++++--
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/dlls/crypt32/ctl.c b/dlls/crypt32/ctl.c
index fa98556..c18e608 100644
--- a/dlls/crypt32/ctl.c
+++ b/dlls/crypt32/ctl.c
@@ -341,7 +341,7 @@ PCCTL_CONTEXT WINAPI CertFindCTLInStore(HCERTSTORE hCertStore,
BOOL WINAPI CertDeleteCTLFromStore(PCCTL_CONTEXT pCtlContext)
{
- WINECRYPT_CERTSTORE *hcs = pCtlContext->hCertStore;
+ WINECRYPT_CERTSTORE *hcs;
ctl_t *ctl = ctl_from_ptr(pCtlContext);
BOOL ret;
@@ -350,6 +350,8 @@ BOOL WINAPI CertDeleteCTLFromStore(PCCTL_CONTEXT pCtlContext)
if (!pCtlContext)
return TRUE;
+ hcs = pCtlContext->hCertStore;
+
if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC)
return FALSE;
diff --git a/dlls/crypt32/store.c b/dlls/crypt32/store.c
index 6c34e55..d5d7443 100644
--- a/dlls/crypt32/store.c
+++ b/dlls/crypt32/store.c
@@ -949,13 +949,15 @@ PCCERT_CONTEXT WINAPI CertEnumCertificatesInStore(HCERTSTORE hCertStore, PCCERT_
BOOL WINAPI CertDeleteCertificateFromStore(PCCERT_CONTEXT pCertContext)
{
- WINECRYPT_CERTSTORE *hcs = pCertContext->hCertStore;
+ WINECRYPT_CERTSTORE *hcs;
TRACE("(%p)\n", pCertContext);
if (!pCertContext)
return TRUE;
+ hcs = pCertContext->hCertStore;
+
if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC)
return FALSE;
@@ -1084,7 +1086,7 @@ BOOL WINAPI CertAddCRLContextToStore(HCERTSTORE hCertStore,
BOOL WINAPI CertDeleteCRLFromStore(PCCRL_CONTEXT pCrlContext)
{
- WINECRYPT_CERTSTORE *hcs = pCrlContext->hCertStore;
+ WINECRYPT_CERTSTORE *hcs;
BOOL ret;
TRACE("(%p)\n", pCrlContext);
@@ -1092,6 +1094,8 @@ BOOL WINAPI CertDeleteCRLFromStore(PCCRL_CONTEXT pCrlContext)
if (!pCrlContext)
return TRUE;
+ hcs = pCrlContext->hCertStore;
+
if (hcs->dwMagic != WINE_CRYPTCERTSTORE_MAGIC)
return FALSE;
--
1.7.10.4
More information about the wine-patches
mailing list