From 5bc13d5d8c8b65b09031baa954a245c889c0b19a Mon Sep 17 00:00:00 2001 From: Tomas Mraz Date: Fri, 20 Sep 2024 14:42:52 +0200 Subject: [PATCH] cmp_vfy_test.c: Avoid NULL pointer dereference Fixes Coverity 1619463 Reviewed-by: Neil Horman Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/25503) --- test/cmp_vfy_test.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/cmp_vfy_test.c b/test/cmp_vfy_test.c index 4ce309992f..114b104497 100644 --- a/test/cmp_vfy_test.c +++ b/test/cmp_vfy_test.c @@ -336,8 +336,9 @@ static int test_validate_msg_signature_sender_cert_extracert(void) || !add_trusted(fixture->cmp_ctx, instaca_cert)) { tear_down(fixture); fixture = NULL; + } else { + fixture->cert = sk_X509_value(fixture->msg->extraCerts, 1); /* Insta CA */ } - fixture->cert = sk_X509_value(fixture->msg->extraCerts, 1); /* Insta CA */ EXECUTE_TEST(execute_validate_msg_test, tear_down); return result; }