[openssl] master update

Dr. Paul Dale pauli at openssl.org
Tue Jun 22 02:43:49 UTC 2021


The branch master has been updated
       via  d65d2963839433bb4f15525df37d0f4f799466e5 (commit)
      from  0c7ec1d2c3a47235ed1e5f9c65769955a41b8b26 (commit)


- Log -----------------------------------------------------------------
commit d65d2963839433bb4f15525df37d0f4f799466e5
Author: Pauli <pauli at openssl.org>
Date:   Mon Jun 21 10:33:10 2021 +1000

    asn1: properly clean up on failed BIO creation
    
    Fixes coverity 1486070 through 1486077 and 1486079
    
    Reviewed-by: Shane Lontis <shane.lontis at oracle.com>
    Reviewed-by: Tomas Mraz <tomas at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/15841)

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

Summary of changes:
 crypto/asn1/asn1_parse.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/crypto/asn1/asn1_parse.c b/crypto/asn1/asn1_parse.c
index a131713d73..04d7ef66cf 100644
--- a/crypto/asn1/asn1_parse.c
+++ b/crypto/asn1/asn1_parse.c
@@ -27,6 +27,7 @@ static int asn1_print_info(BIO *bp, long offset, int depth, int hl, long len,
     int pop_f_prefix = 0;
     long saved_indent = -1;
     int i = 0;
+    BIO *bio = NULL;
 
     if (constructed & V_ASN1_CONSTRUCTED)
         p = "cons: ";
@@ -43,7 +44,8 @@ static int asn1_print_info(BIO *bp, long offset, int depth, int hl, long len,
     }
     if (bp != NULL) {
         if (BIO_set_prefix(bp, str) <= 0) {
-            if ((bp = BIO_push(BIO_new(BIO_f_prefix()), bp)) == NULL)
+            if ((bio = BIO_new(BIO_f_prefix())) == NULL
+                    || (bp = BIO_push(bio, bp)) == NULL)
                 goto err;
             pop_f_prefix = 1;
         }
@@ -72,10 +74,9 @@ static int asn1_print_info(BIO *bp, long offset, int depth, int hl, long len,
  err:
     if (saved_indent >= 0)
         BIO_set_indent(bp, saved_indent);
-    if (pop_f_prefix) {
+    if (pop_f_prefix)
         BIO_pop(bp);
-        BIO_free(bp);
-    }
+    BIO_free(bio);
     return i;
 }
 


More information about the openssl-commits mailing list