From: yuanjungong Date: Thu, 7 Apr 2022 04:35:59 +0000 (+0800) Subject: Crypto/evp: Fix null pointer dereference X-Git-Tag: openssl-3.2.0-alpha1~2776 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f1424c6bdca8ddb9d5d88a78a1d738be19c4ea8;p=thirdparty%2Fopenssl.git Crypto/evp: Fix null pointer dereference Check the return value of EVP_KDF_fetch to avoid a potential null pointer dereference. Reviewed-by: Tomas Mraz Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/18062) --- diff --git a/crypto/evp/p5_crpt2.c b/crypto/evp/p5_crpt2.c index 7088875fe1f..4c82241f377 100644 --- a/crypto/evp/p5_crpt2.c +++ b/crypto/evp/p5_crpt2.c @@ -42,6 +42,8 @@ int ossl_pkcs5_pbkdf2_hmac_ex(const char *pass, int passlen, salt = (unsigned char *)empty; kdf = EVP_KDF_fetch(libctx, OSSL_KDF_NAME_PBKDF2, propq); + if (kdf == NULL) + return 0; kctx = EVP_KDF_CTX_new(kdf); EVP_KDF_free(kdf); if (kctx == NULL)