[openssl-commits] [openssl] OpenSSL_1_0_2-stable update

Matt Caswell matt at openssl.org
Mon Mar 12 19:21:25 UTC 2018


The branch OpenSSL_1_0_2-stable has been updated
       via  c46343fe662df971755df6cf66c50e531b032745 (commit)
      from  d777ca4900e0de94df5590f2957962cdd231c18c (commit)


- Log -----------------------------------------------------------------
commit c46343fe662df971755df6cf66c50e531b032745
Author: Matt Caswell <matt at openssl.org>
Date:   Mon Mar 12 13:56:34 2018 +0000

    Improve error handling in pk7_doit
    
    If a mem allocation failed we would ignore it. This commit fixes it to
    always check.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/5596)
    
    (cherry picked from commit 4718f449a3ecd5efac62b22d0fa9a759a7895dbc)

-----------------------------------------------------------------------

Summary of changes:
 crypto/pkcs7/pk7_doit.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/crypto/pkcs7/pk7_doit.c b/crypto/pkcs7/pk7_doit.c
index 6cf8253..6a46368 100644
--- a/crypto/pkcs7/pk7_doit.c
+++ b/crypto/pkcs7/pk7_doit.c
@@ -375,16 +375,18 @@ BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio)
     }
 
     if (bio == NULL) {
-        if (PKCS7_is_detached(p7))
+        if (PKCS7_is_detached(p7)) {
             bio = BIO_new(BIO_s_null());
-        else if (os && os->length > 0)
+        } else if (os && os->length > 0) {
             bio = BIO_new_mem_buf(os->data, os->length);
-        if (bio == NULL) {
+        } else {
             bio = BIO_new(BIO_s_mem());
             if (bio == NULL)
                 goto err;
             BIO_set_mem_eof_return(bio, 0);
         }
+        if (bio == NULL)
+            goto err;
     }
     if (out)
         BIO_push(out, bio);


More information about the openssl-commits mailing list