crypt32: Fix duplicating a NULL CTL context.
This commit is contained in:
parent
acc9d81f26
commit
dd26bee14c
|
@ -455,6 +455,7 @@ end:
|
||||||
PCCTL_CONTEXT WINAPI CertDuplicateCTLContext(PCCTL_CONTEXT pCtlContext)
|
PCCTL_CONTEXT WINAPI CertDuplicateCTLContext(PCCTL_CONTEXT pCtlContext)
|
||||||
{
|
{
|
||||||
TRACE("(%p)\n", pCtlContext);
|
TRACE("(%p)\n", pCtlContext);
|
||||||
|
if (pCtlContext)
|
||||||
Context_AddRef((void *)pCtlContext, sizeof(CTL_CONTEXT));
|
Context_AddRef((void *)pCtlContext, sizeof(CTL_CONTEXT));
|
||||||
return pCtlContext;
|
return pCtlContext;
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,6 +187,21 @@ static void testCreateCTL(void)
|
||||||
CertFreeCTLContext(ctl);
|
CertFreeCTLContext(ctl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void testDupCTL(void)
|
||||||
|
{
|
||||||
|
PCCTL_CONTEXT context, dupContext;
|
||||||
|
|
||||||
|
context = CertDuplicateCTLContext(NULL);
|
||||||
|
ok(context == NULL, "expected NULL\n");
|
||||||
|
context = CertCreateCTLContext(X509_ASN_ENCODING,
|
||||||
|
signedCTLWithCTLInnerContent, sizeof(signedCTLWithCTLInnerContent));
|
||||||
|
dupContext = CertDuplicateCTLContext(context);
|
||||||
|
ok(dupContext != NULL, "expected a context\n");
|
||||||
|
ok(dupContext == context, "expected identical context addresses\n");
|
||||||
|
CertFreeCTLContext(dupContext);
|
||||||
|
CertFreeCTLContext(context);
|
||||||
|
}
|
||||||
|
|
||||||
static void checkHash(const BYTE *data, DWORD dataLen, ALG_ID algID,
|
static void checkHash(const BYTE *data, DWORD dataLen, ALG_ID algID,
|
||||||
PCCTL_CONTEXT context, DWORD propID)
|
PCCTL_CONTEXT context, DWORD propID)
|
||||||
{
|
{
|
||||||
|
@ -444,6 +459,7 @@ static void testAddCTLToStore(void)
|
||||||
START_TEST(ctl)
|
START_TEST(ctl)
|
||||||
{
|
{
|
||||||
testCreateCTL();
|
testCreateCTL();
|
||||||
|
testDupCTL();
|
||||||
testCTLProperties();
|
testCTLProperties();
|
||||||
testAddCTLToStore();
|
testAddCTLToStore();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue