diff options
author | x2018 <xkernel.wang@foxmail.com> | 2021-10-22 22:50:27 +0800 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2021-10-27 08:38:30 +1000 |
commit | d146811f6cce155eeb1a87396943c953acb08fb6 (patch) | |
tree | 64740a768140dd293a2d4e5475e097ce3c7300ab /crypto/pem | |
parent | 1682a8524652c4f1386852f0d0c1dec75895b7da (diff) |
add checks for the return values of BN_new(), sk_RSA_PRIME_INFO_new_reserve(),
EVP_PKEY_CTX_new_from_pkey() and EVP_CIPHER_CTX_new().
Otherwise may result in memory errors.
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16892)
(cherry picked from commit 9dddcd90a1350fa63486cbf3226c3eee79f9aff5)
Diffstat (limited to 'crypto/pem')
-rw-r--r-- | crypto/pem/pvkfmt.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/crypto/pem/pvkfmt.c b/crypto/pem/pvkfmt.c index 11ac0a7c40..21b16f5928 100644 --- a/crypto/pem/pvkfmt.c +++ b/crypto/pem/pvkfmt.c @@ -832,6 +832,11 @@ static void *do_PVK_body_key(const unsigned char **in, #endif EVP_CIPHER_CTX *cctx = EVP_CIPHER_CTX_new(); + if (cctx == NULL) { + ERR_raise(ERR_LIB_PEM, ERR_R_MALLOC_FAILURE); + goto err; + } + if (saltlen) { #ifndef OPENSSL_NO_RC4 unsigned int magic; |