summaryrefslogtreecommitdiff
path: root/test/evp_test.c
diff options
context:
space:
mode:
authorPauli <pauli@openssl.org>2021-06-25 12:56:57 +1000
committerPauli <pauli@openssl.org>2021-06-26 11:33:52 +1000
commit1f25fd161698e7b93d43872735793b084f2d92af (patch)
treeca7597a2a33219694836a9841ba17d0d5c11173a /test/evp_test.c
parenta52d20c82a82a0c1d5ecf9f1337906c6783f0971 (diff)
downloadopenssl-new-1f25fd161698e7b93d43872735793b084f2d92af.tar.gz
evp_test: address NULL pointer dereference and return failure better
Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/15910)
Diffstat (limited to 'test/evp_test.c')
-rw-r--r--test/evp_test.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/test/evp_test.c b/test/evp_test.c
index 2310fb7907..16b1a50c2d 100644
--- a/test/evp_test.c
+++ b/test/evp_test.c
@@ -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;