diff options
author | yuanjungong <yuanjungong96@gmail.com> | 2022-04-07 12:35:59 +0800 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2022-04-11 14:13:57 +1000 |
commit | 5f1424c6bdca8ddb9d5d88a78a1d738be19c4ea8 (patch) | |
tree | e9fa66083ce4ecfc30cf9ad38c4b80a8e4206170 /crypto/evp | |
parent | 148176ca323e3dfce5d5cdb5578c113c8d2440bb (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)
Diffstat (limited to 'crypto/evp')
-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) |