summaryrefslogtreecommitdiffstats
path: root/crypto/cms
diff options
context:
space:
mode:
authorAlon Bar-Lev <alon.barlev@gmail.com>2022-07-26 15:17:06 +0300
committerHugo Landau <hlandau@openssl.org>2022-07-28 10:05:59 +0100
commit67c0460b89cc1b0644a1a59af78284dfd8d720af (patch)
tree90dc060cd2fb8ec810f9d58d691f056f0ff3f3bb /crypto/cms
parentb03756130dadb3732b460a6efd930f1b226acdad (diff)
Handle SMIME_crlf_copy return code
Currently the SMIME_crlf_copy result is ignored in all usages. It does return failure when memory allocation fails. This patch handles the SMIME_crlf_copy return code in all occurrences. Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18876)
Diffstat (limited to 'crypto/cms')
-rw-r--r--crypto/cms/cms_smime.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/crypto/cms/cms_smime.c b/crypto/cms/cms_smime.c
index 4f5d626fb6..b9d43c7204 100644
--- a/crypto/cms/cms_smime.c
+++ b/crypto/cms/cms_smime.c
@@ -432,7 +432,8 @@ int CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs,
* Don't use SMIME_TEXT for verify: it adds headers and we want to
* remove them.
*/
- SMIME_crlf_copy(dcont, cmsbio, flags & ~SMIME_TEXT);
+ if (!SMIME_crlf_copy(dcont, cmsbio, flags & ~SMIME_TEXT))
+ goto err;
if (flags & CMS_TEXT) {
if (!SMIME_text(tmpout, out)) {
@@ -882,7 +883,9 @@ int CMS_final(CMS_ContentInfo *cms, BIO *data, BIO *dcont, unsigned int flags)
return 0;
}
- SMIME_crlf_copy(data, cmsbio, flags);
+ if (!SMIME_crlf_copy(data, cmsbio, flags)) {
+ goto err;
+ }
(void)BIO_flush(cmsbio);