]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
evp_test: address NULL pointer dereference and return failure better
authorPauli <pauli@openssl.org>
Fri, 25 Jun 2021 02:56:57 +0000 (12:56 +1000)
committerPauli <pauli@openssl.org>
Sat, 26 Jun 2021 01:33:52 +0000 (11:33 +1000)
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/15910)

test/evp_test.c

index 2310fb7907f2bfc713af4b1f3ca65737cf6a999a..16b1a50c2d9e035c3ee63d865f2f9a23c2f886da 100644 (file)
@@ -2006,8 +2006,10 @@ static int pbe_test_init(EVP_TEST *t, const char *alg)
         pbe_type = PBE_TYPE_PKCS12;
     } else {
         TEST_error("Unknown pbe algorithm %s", alg);
+        return 0;
     }
-    pdat = OPENSSL_zalloc(sizeof(*pdat));
+    if (!TEST_ptr(pdat = OPENSSL_zalloc(sizeof(*pdat))))
+        return 0;
     pdat->pbe_type = pbe_type;
     t->data = pdat;
     return 1;