From 769a52f8319668f2f717c1341b0760964637767d Mon Sep 17 00:00:00 2001 From: Juan Lang Date: Mon, 15 May 2006 17:00:06 -0700 Subject: [PATCH] crypt32: Avoid a use-after-free bug in tests. --- dlls/crypt32/tests/store.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dlls/crypt32/tests/store.c b/dlls/crypt32/tests/store.c index e798ce45b68..6df1ea29468 100644 --- a/dlls/crypt32/tests/store.c +++ b/dlls/crypt32/tests/store.c @@ -149,6 +149,10 @@ static void testAddCert(void) CRYPT_DATA_BLOB hash = { sizeof(bigCert2Hash), (LPBYTE)bigCert2Hash }; + /* Duplicate (AddRef) the context so we can still use it after + * deleting it from the store. + */ + CertDuplicateCertificateContext(context); CertDeleteCertificateFromStore(context); /* Set the same hash as bigCert2, and try to readd it */ ret = CertSetCertificateContextProperty(context, CERT_HASH_PROP_ID,