diff options
author | x2018 <xkernel.wang@foxmail.com> | 2021-10-22 22:50:27 +0800 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2021-10-27 08:36:55 +1000 |
commit | 9dddcd90a1350fa63486cbf3226c3eee79f9aff5 (patch) | |
tree | f55ee0a9a4318165e3d40cc6a6e2a0b4db69e6d8 /crypto/pem | |
parent | 7220085f22cf6c49933ea8287eb15db57f7ab0db (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)
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 6f5207abd1..83166b5887 100644 --- a/crypto/pem/pvkfmt.c +++ b/crypto/pem/pvkfmt.c @@ -839,6 +839,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; |