From: Pauli Date: Fri, 25 Jun 2021 02:56:57 +0000 (+1000) Subject: evp_test: address NULL pointer dereference and return failure better X-Git-Tag: openssl-3.0.0-beta2~185 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1f25fd161698e7b93d43872735793b084f2d92af;p=thirdparty%2Fopenssl.git evp_test: address NULL pointer dereference and return failure better Reviewed-by: Shane Lontis (Merged from https://github.com/openssl/openssl/pull/15910) --- diff --git a/test/evp_test.c b/test/evp_test.c index 2310fb7907f..16b1a50c2d9 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;