Commit 82185186 authored by Paul Vriens's avatar Paul Vriens Committed by Alexandre Julliard

crypt32: Fix CertDuplicateCertificateContext for a passed NULL context.

parent ff8bd24e
...@@ -115,6 +115,10 @@ PCCERT_CONTEXT WINAPI CertDuplicateCertificateContext( ...@@ -115,6 +115,10 @@ PCCERT_CONTEXT WINAPI CertDuplicateCertificateContext(
PCCERT_CONTEXT pCertContext) PCCERT_CONTEXT pCertContext)
{ {
TRACE("(%p)\n", pCertContext); TRACE("(%p)\n", pCertContext);
if (!pCertContext)
return NULL;
Context_AddRef((void *)pCertContext, sizeof(CERT_CONTEXT)); Context_AddRef((void *)pCertContext, sizeof(CERT_CONTEXT));
return pCertContext; return pCertContext;
} }
......
...@@ -3136,6 +3136,16 @@ static void testGetPublicKeyLength(void) ...@@ -3136,6 +3136,16 @@ static void testGetPublicKeyLength(void)
ok(ret == 56, "Expected length 56, got %d\n", ret); ok(ret == 56, "Expected length 56, got %d\n", ret);
} }
static void testCertDuplicateCertificateContext(void)
{
PCCERT_CONTEXT context;
SetLastError(0xdeadbeef);
context = CertDuplicateCertificateContext(NULL);
ok(context == NULL, "Expected context to be NULL\n");
}
START_TEST(cert) START_TEST(cert)
{ {
init_function_pointers(); init_function_pointers();
...@@ -3163,4 +3173,5 @@ START_TEST(cert) ...@@ -3163,4 +3173,5 @@ START_TEST(cert)
testVerifyRevocation(); testVerifyRevocation();
testAcquireCertPrivateKey(); testAcquireCertPrivateKey();
testGetPublicKeyLength(); testGetPublicKeyLength();
testCertDuplicateCertificateContext();
} }
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