]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
cmp_vfy_test.c: Avoid NULL pointer dereference
authorTomas Mraz <tomas@openssl.org>
Fri, 20 Sep 2024 12:42:52 +0000 (14:42 +0200)
committerTomas Mraz <tomas@openssl.org>
Mon, 7 Oct 2024 15:41:22 +0000 (17:41 +0200)
Fixes Coverity 1619463

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25503)

test/cmp_vfy_test.c

index 4ce309992fce4f1033311b697c6778b535669aba..114b1044975faff28edd9f6a581ae0af7d0f6053 100644 (file)
@@ -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;
 }