From 1f25fd161698e7b93d43872735793b084f2d92af Mon Sep 17 00:00:00 2001 From: Pauli Date: Fri, 25 Jun 2021 12:56:57 +1000 Subject: evp_test: address NULL pointer dereference and return failure better Reviewed-by: Shane Lontis (Merged from https://github.com/openssl/openssl/pull/15910) --- test/evp_test.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'test/evp_test.c') 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; -- cgit v1.2.1