[openssl-commits] [openssl] OpenSSL_1_0_1-stable update

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


The branch OpenSSL_1_0_1-stable has been updated
       via  4275ee389b4092363ed8f2f2fa8aa0240b0ea122 (commit)
       via  d31b25138f26cad65182a325561f929d67806248 (commit)
      from  4161523ecd06b1e469b6e59e705ac8bec18611b6 (commit)


- Log -----------------------------------------------------------------
commit 4275ee389b4092363ed8f2f2fa8aa0240b0ea122
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 d31b25138f26cad65182a325561f929d67806248
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 aaa1867..19c3da6 100644
--- a/ssl/d1_both.c
+++ b/ssl/d1_both.c
@@ -1579,6 +1579,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 2e9b65b..0bdb77d 100644
--- a/ssl/t1_lib.c
+++ b/ssl/t1_lib.c
@@ -2321,8 +2321,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) {
@@ -2579,6 +2581,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