diff options
author | Dmitry Belyavskiy <beldmit@gmail.com> | 2020-10-07 13:23:01 +0300 |
---|---|---|
committer | Dmitry Belyavskiy <beldmit@gmail.com> | 2020-10-08 18:17:44 +0300 |
commit | 13c5ec569ea9286ff18e019fb2d53be64829c62c (patch) | |
tree | 759ae93e7305772c97379dfc94638fa2fa1e95fc | |
parent | 947fb813458cd93fdc31f6248f5806d9f4fddff3 (diff) |
Fix zero-length content verification in S/MIME format
Fixes #13082
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13087)
-rw-r--r-- | crypto/cms/cms_smime.c | 2 | ||||
-rw-r--r-- | crypto/pkcs7/pk7_smime.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/crypto/cms/cms_smime.c b/crypto/cms/cms_smime.c index f9a851950f..c8bec75cdd 100644 --- a/crypto/cms/cms_smime.c +++ b/crypto/cms/cms_smime.c @@ -401,7 +401,7 @@ int CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs, long len; len = BIO_get_mem_data(dcont, &ptr); - tmpin = BIO_new_mem_buf(ptr, len); + tmpin = (len == 0) ? dcont : BIO_new_mem_buf(ptr, len); if (tmpin == NULL) { CMSerr(CMS_F_CMS_VERIFY, ERR_R_MALLOC_FAILURE); goto err2; diff --git a/crypto/pkcs7/pk7_smime.c b/crypto/pkcs7/pk7_smime.c index 5cbc18c63e..e9ae4f3394 100644 --- a/crypto/pkcs7/pk7_smime.c +++ b/crypto/pkcs7/pk7_smime.c @@ -311,7 +311,7 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, char *ptr; long len; len = BIO_get_mem_data(indata, &ptr); - tmpin = BIO_new_mem_buf(ptr, len); + tmpin = (len == 0) ? indata : BIO_new_mem_buf(ptr, len); if (tmpin == NULL) { PKCS7err(0, ERR_R_MALLOC_FAILURE); goto err; |