diff options
author | Dmitry Belyavskiy <beldmit@gmail.com> | 2020-10-09 20:04:05 +0300 |
---|---|---|
committer | Dmitry Belyavskiy <beldmit@gmail.com> | 2020-11-11 13:50:42 +0300 |
commit | 6f1bee08cf80b9473496991b51f1f4a0decd96de (patch) | |
tree | da05317258eca1cd41e6b9eb11169b7f4fbf5923 /crypto | |
parent | 6e933b35492a4dc3370b9f49890646dadca82cd8 (diff) |
Verification zero-length content in S/MIME format
Fixes #13082
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13106)
Diffstat (limited to 'crypto')
-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 652e97b2e8..2c475ea68c 100644 --- a/crypto/cms/cms_smime.c +++ b/crypto/cms/cms_smime.c @@ -341,7 +341,7 @@ int CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs, char *ptr; 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 44187230ef..4ce44d8d93 100644 --- a/crypto/pkcs7/pk7_smime.c +++ b/crypto/pkcs7/pk7_smime.c @@ -301,7 +301,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(PKCS7_F_PKCS7_VERIFY, ERR_R_MALLOC_FAILURE); goto err; |