Signed-off-by: Alistair Leslie-Hughes leslie_alistair@hotmail.com --- dlls/wintrust/tests/softpub.c | 9 +++++++++ dlls/wintrust/wintrust_main.c | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/dlls/wintrust/tests/softpub.c b/dlls/wintrust/tests/softpub.c index 6e7913f710..eb72512ddc 100644 --- a/dlls/wintrust/tests/softpub.c +++ b/dlls/wintrust/tests/softpub.c @@ -929,6 +929,14 @@ static void test_get_known_usages(void) "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); }
+static void test_WTHelperGetProvCertFromChain(void) +{ + CRYPT_PROVIDER_CERT *cert; + + cert = WTHelperGetProvCertFromChain(NULL, 0); + ok(!cert, "got certificate\n"); +} + START_TEST(softpub) { InitFunctionPtrs(); @@ -936,4 +944,5 @@ START_TEST(softpub) test_sip_create_indirect_data(); test_wintrust(); test_get_known_usages(); + test_WTHelperGetProvCertFromChain(); } diff --git a/dlls/wintrust/wintrust_main.c b/dlls/wintrust/wintrust_main.c index 58e3ac39c0..bb5228286f 100644 --- a/dlls/wintrust/wintrust_main.c +++ b/dlls/wintrust/wintrust_main.c @@ -787,7 +787,7 @@ CRYPT_PROVIDER_CERT * WINAPI WTHelperGetProvCertFromChain(
TRACE("(%p %d)\n", pSgnr, idxCert);
- if (idxCert >= pSgnr->csCertChain || !pSgnr->pasCertChain) + if (!pSgnr || idxCert >= pSgnr->csCertChain || !pSgnr->pasCertChain) return NULL; cert = &pSgnr->pasCertChain[idxCert]; TRACE("returning %p\n", cert);