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/cms | |
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/cms')
-rw-r--r-- | crypto/cms/cms_pwri.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/crypto/cms/cms_pwri.c b/crypto/cms/cms_pwri.c index bc2b5179b7..380240561f 100644 --- a/crypto/cms/cms_pwri.c +++ b/crypto/cms/cms_pwri.c @@ -85,6 +85,10 @@ CMS_RecipientInfo *CMS_add0_recipient_password(CMS_ContentInfo *cms, goto merr; } ctx = EVP_CIPHER_CTX_new(); + if (ctx == NULL) { + ERR_raise(ERR_LIB_CMS, ERR_R_MALLOC_FAILURE); + goto err; + } if (EVP_EncryptInit_ex(ctx, kekciph, NULL, NULL, NULL) <= 0) { ERR_raise(ERR_LIB_CMS, ERR_R_EVP_LIB); |