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

Matt Caswell matt at openssl.org
Fri Mar 18 12:04:01 UTC 2016


The branch OpenSSL_1_0_2-stable has been updated
       via  04d5242c46b0f348f5ab92e9764f138547b237c5 (commit)
       via  3b93479fcfd335622bb9e5e8cc08acd328750f44 (commit)
      from  e78dc7e279ed98e1ab9845a70d14dafdfdc88f58 (commit)


- Log -----------------------------------------------------------------
commit 04d5242c46b0f348f5ab92e9764f138547b237c5
Author: Matt Caswell <matt at openssl.org>
Date:   Tue Mar 15 11:51:48 2016 +0000

    Add a check for a failed malloc
    
    Ensure we check for a NULL return from OPENSSL_malloc
    
    Issue reported by Guido Vranken.
    
    Reviewed-by: Richard Levitte <levitte at openssl.org>

commit 3b93479fcfd335622bb9e5e8cc08acd328750f44
Author: Matt Caswell <matt at openssl.org>
Date:   Tue Mar 15 11:38:56 2016 +0000

    Ensure that memory allocated for the ticket is freed
    
    If a call to EVP_DecryptUpdate fails then a memory leak could occur.
    Ensure that the memory is freed appropriately.
    
    Issue reported by Guido Vranken.
    
    Reviewed-by: Richard Levitte <levitte at openssl.org>

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

Summary of changes:
 ssl/d1_both.c | 2 ++
 ssl/t1_lib.c  | 6 +++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/ssl/d1_both.c b/ssl/d1_both.c
index d1fc716..5d26c94 100644
--- a/ssl/d1_both.c
+++ b/ssl/d1_both.c
@@ -1459,6 +1459,8 @@ int dtls1_process_heartbeat(SSL *s)
          * plus 2 bytes payload length, plus payload, plus padding
          */
         buffer = OPENSSL_malloc(write_length);
+        if (buffer == NULL)
+            return -1;
         bp = buffer;
 
         /* Enter response type, length and copy payload */
diff --git a/ssl/t1_lib.c b/ssl/t1_lib.c
index d9ba99d..0bf0ea5 100644
--- a/ssl/t1_lib.c
+++ b/ssl/t1_lib.c
@@ -3415,8 +3415,10 @@ static int tls_decrypt_ticket(SSL *s, const unsigned char *etick,
     p = etick + 16 + EVP_CIPHER_CTX_iv_length(&ctx);
     eticklen -= 16 + EVP_CIPHER_CTX_iv_length(&ctx);
     sdec = OPENSSL_malloc(eticklen);
-    if (!sdec || EVP_DecryptUpdate(&ctx, sdec, &slen, p, eticklen) <= 0) {
+    if (sdec == NULL
+            || EVP_DecryptUpdate(&ctx, sdec, &slen, p, eticklen) <= 0) {
         EVP_CIPHER_CTX_cleanup(&ctx);
+        OPENSSL_free(sdec);
         return -1;
     }
     if (EVP_DecryptFinal(&ctx, sdec + slen, &mlen) <= 0) {
@@ -3856,6 +3858,8 @@ int tls1_process_heartbeat(SSL *s)
          * plus 2 bytes payload length, plus payload, plus padding
          */
         buffer = OPENSSL_malloc(1 + 2 + payload + padding);
+        if (buffer == NULL)
+            return -1;
         bp = buffer;
 
         /* Enter response type, length and copy payload */


More information about the openssl-commits mailing list