2022-03-11 16:27:46 -08:00
|
|
|
From d5ac0d0d4a4e5d26f2892572502ab7e7fd5d812e Mon Sep 17 00:00:00 2001
|
2018-04-25 18:24:46 -07:00
|
|
|
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
|
|
|
|
Date: Wed, 18 Apr 2018 03:55:16 +0000
|
|
|
|
Subject: [PATCH] wintrust: Add parameter check in WTHelperGetProvCertFromChain
|
|
|
|
|
|
|
|
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
|
2022-03-11 16:27:46 -08:00
|
|
|
index 8195e6006b1..1fa99fa71ce 100644
|
2018-04-25 18:24:46 -07:00
|
|
|
--- a/dlls/wintrust/tests/softpub.c
|
|
|
|
+++ b/dlls/wintrust/tests/softpub.c
|
2022-02-22 19:27:11 -08:00
|
|
|
@@ -1312,6 +1312,14 @@ static void test_get_known_usages(void)
|
2022-03-11 16:27:46 -08:00
|
|
|
"expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
|
2018-04-25 18:24:46 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
+static void test_WTHelperGetProvCertFromChain(void)
|
|
|
|
+{
|
|
|
|
+ CRYPT_PROVIDER_CERT *cert;
|
|
|
|
+
|
|
|
|
+ cert = WTHelperGetProvCertFromChain(NULL, 0);
|
|
|
|
+ ok(!cert, "got certificate\n");
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
START_TEST(softpub)
|
|
|
|
{
|
|
|
|
InitFunctionPtrs();
|
2022-02-22 19:27:11 -08:00
|
|
|
@@ -1320,4 +1328,5 @@ START_TEST(softpub)
|
2018-04-25 18:24:46 -07:00
|
|
|
test_wintrust();
|
|
|
|
test_wintrust_digest();
|
|
|
|
test_get_known_usages();
|
|
|
|
+ test_WTHelperGetProvCertFromChain();
|
|
|
|
}
|
|
|
|
diff --git a/dlls/wintrust/wintrust_main.c b/dlls/wintrust/wintrust_main.c
|
2022-02-22 19:27:11 -08:00
|
|
|
index 33695008b24..60c633e5abf 100644
|
2018-04-25 18:24:46 -07:00
|
|
|
--- a/dlls/wintrust/wintrust_main.c
|
|
|
|
+++ b/dlls/wintrust/wintrust_main.c
|
2022-02-22 19:27:11 -08:00
|
|
|
@@ -782,7 +782,7 @@ CRYPT_PROVIDER_CERT * WINAPI WTHelperGetProvCertFromChain(
|
2018-04-25 18:24:46 -07:00
|
|
|
|
2022-02-22 19:27:11 -08:00
|
|
|
TRACE("(%p %ld)\n", pSgnr, idxCert);
|
2018-04-25 18:24:46 -07:00
|
|
|
|
|
|
|
- if (idxCert >= pSgnr->csCertChain || !pSgnr->pasCertChain)
|
|
|
|
+ if (!pSgnr || idxCert >= pSgnr->csCertChain || !pSgnr->pasCertChain)
|
|
|
|
return NULL;
|
|
|
|
cert = &pSgnr->pasCertChain[idxCert];
|
|
|
|
TRACE("returning %p\n", cert);
|
|
|
|
--
|
2022-03-11 16:27:46 -08:00
|
|
|
2.35.1
|
2018-04-25 18:24:46 -07:00
|
|
|
|