Juan Lang : crypt32: Fix duplicating a NULL CRL context.
Module: wine Branch: master Commit: acc9d81f26213628545c546c758f9b9b23633a92 URL: http://source.winehq.org/git/wine.git/?a=commit;h=acc9d81f26213628545c546c75... Author: Juan Lang <juan.lang(a)gmail.com> Date: Tue Oct 20 09:52:36 2009 -0700 crypt32: Fix duplicating a NULL CRL context. --- dlls/crypt32/crl.c | 3 ++- dlls/crypt32/tests/crl.c | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletions(-) diff --git a/dlls/crypt32/crl.c b/dlls/crypt32/crl.c index 271e4e0..80fe86f 100644 --- a/dlls/crypt32/crl.c +++ b/dlls/crypt32/crl.c @@ -228,7 +228,8 @@ PCCRL_CONTEXT WINAPI CertGetCRLFromStore(HCERTSTORE hCertStore, PCCRL_CONTEXT WINAPI CertDuplicateCRLContext(PCCRL_CONTEXT pCrlContext) { TRACE("(%p)\n", pCrlContext); - Context_AddRef((void *)pCrlContext, sizeof(CRL_CONTEXT)); + if (pCrlContext) + Context_AddRef((void *)pCrlContext, sizeof(CRL_CONTEXT)); return pCrlContext; } diff --git a/dlls/crypt32/tests/crl.c b/dlls/crypt32/tests/crl.c index abd8491..1b8cb18 100644 --- a/dlls/crypt32/tests/crl.c +++ b/dlls/crypt32/tests/crl.c @@ -118,6 +118,21 @@ static void testCreateCRL(void) CertFreeCRLContext(context); } +static void testDupCRL(void) +{ + PCCRL_CONTEXT context, dupContext; + + context = CertDuplicateCRLContext(NULL); + ok(context == NULL, "expected NULL\n"); + context = CertCreateCRLContext(X509_ASN_ENCODING, signedCRL, + sizeof(signedCRL)); + dupContext = CertDuplicateCRLContext(context); + ok(dupContext != NULL, "expected a context\n"); + ok(dupContext == context, "expected identical context addresses\n"); + CertFreeCRLContext(dupContext); + CertFreeCRLContext(context); +} + static void testAddCRL(void) { HCERTSTORE store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0, @@ -722,6 +737,7 @@ START_TEST(crl) init_function_pointers(); testCreateCRL(); + testDupCRL(); testAddCRL(); testFindCRL(); testGetCRLFromStore();
participants (1)
-
Alexandre Julliard