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

Dr. Stephen Henson steve at openssl.org
Fri Apr 29 20:43:21 UTC 2016


The branch OpenSSL_1_0_2-stable has been updated
       via  64eaf6c928f4066d62aa86f805796ef05bd0b1cc (commit)
      from  9b08619cb45e75541809b1154c90e1a00450e537 (commit)


- Log -----------------------------------------------------------------
commit 64eaf6c928f4066d62aa86f805796ef05bd0b1cc
Author: Dr. Stephen Henson <steve at openssl.org>
Date:   Wed Apr 27 20:27:41 2016 +0100

    Don't free ret->data if malloc fails.
    
    Issue reported by Guido Vranken.
    
    Reviewed-by: Matt Caswell <matt at openssl.org>

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

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

diff --git a/crypto/asn1/a_bytes.c b/crypto/asn1/a_bytes.c
index 12715a7..385b539 100644
--- a/crypto/asn1/a_bytes.c
+++ b/crypto/asn1/a_bytes.c
@@ -200,13 +200,13 @@ ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp,
     } else {
         if (len != 0) {
             if ((ret->length < len) || (ret->data == NULL)) {
-                if (ret->data != NULL)
-                    OPENSSL_free(ret->data);
                 s = (unsigned char *)OPENSSL_malloc((int)len + 1);
                 if (s == NULL) {
                     i = ERR_R_MALLOC_FAILURE;
                     goto err;
                 }
+                if (ret->data != NULL)
+                    OPENSSL_free(ret->data);
             } else
                 s = ret->data;
             memcpy(s, p, (int)len);


More information about the openssl-commits mailing list