From 9d71a6622be15592ad75dd4e6c5816c9042611e9 Mon Sep 17 00:00:00 2001 From: JohnnySavages Date: Wed, 24 Jul 2024 07:17:49 -0400 Subject: [PATCH] Check sk_X509_value result before dereference issuer passed as second parameter to check_issued may result in NULL dereference CLA: trivial Reviewed-by: Hugo Landau Reviewed-by: Paul Dale Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/24760) --- crypto/x509/x509_vfy.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crypto/x509/x509_vfy.c b/crypto/x509/x509_vfy.c index 1794c14e9920a..8257b431ea598 100644 --- a/crypto/x509/x509_vfy.c +++ b/crypto/x509/x509_vfy.c @@ -1606,6 +1606,8 @@ static int check_crl(X509_STORE_CTX *ctx, X509_CRL *crl) issuer = sk_X509_value(ctx->chain, cnum + 1); } else { issuer = sk_X509_value(ctx->chain, chnum); + if (!ossl_assert(issuer != NULL)) + return 0; /* If not self-issued, can't check signature */ if (!ctx->check_issued(ctx, issuer, issuer) && !verify_cb_crl(ctx, X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER))