diff options
author | yuanjungong <yuanjungong96@gmail.com> | 2022-04-07 12:35:59 +0800 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2022-04-11 14:14:30 +1000 |
commit | aea2d74bdce61c8aaa942cf03fb1ca9761e9f3a8 (patch) | |
tree | a452f57113b979182605ff525a5e68172b67c52e /crypto/evp/p5_crpt2.c | |
parent | 7d486b2c0ea43227b5d9b6d3b66a5f4365ecdbae (diff) |
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 <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18062)
(cherry picked from commit 5f1424c6bdca8ddb9d5d88a78a1d738be19c4ea8)
Diffstat (limited to 'crypto/evp/p5_crpt2.c')
-rw-r--r-- | crypto/evp/p5_crpt2.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/crypto/evp/p5_crpt2.c b/crypto/evp/p5_crpt2.c index 7088875fe1..4c82241f37 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) |