diff options
author | Rich Salz <rsalz@openssl.org> | 2017-11-27 14:11:36 -0500 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2017-11-27 14:47:42 -0500 |
commit | 378db52bb0177ae03cac3c3ba194bb6dec34a2d7 (patch) | |
tree | e8a80617c355e83119c3b7c68ba03e0b51d0341e /crypto/cms | |
parent | 8a8d9e190533ee41e8b231b18c7837f98f1ae231 (diff) |
Check for malloc failure
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/4805)
Diffstat (limited to 'crypto/cms')
-rw-r--r-- | crypto/cms/cms_sd.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/crypto/cms/cms_sd.c b/crypto/cms/cms_sd.c index 764781688b..ff2d540b6a 100644 --- a/crypto/cms/cms_sd.c +++ b/crypto/cms/cms_sd.c @@ -714,8 +714,10 @@ int CMS_SignerInfo_verify(CMS_SignerInfo *si) md = EVP_get_digestbyobj(si->digestAlgorithm->algorithm); if (md == NULL) return -1; - if (si->mctx == NULL) - si->mctx = EVP_MD_CTX_new(); + if (si->mctx == NULL && (si->mctx = EVP_MD_CTX_new()) == NULL) { + CMSerr(CMS_F_CMS_SIGNERINFO_VERIFY, ERR_R_MALLOC_FAILURE); + return -1; + } mctx = si->mctx; if (EVP_DigestVerifyInit(mctx, &si->pctx, md, NULL, si->pkey) <= 0) goto err; |