[openssl-commits] [openssl] OpenSSL_1_1_0-stable update

Rich Salz rsalz at openssl.org
Wed Mar 8 14:49:25 UTC 2017


The branch OpenSSL_1_1_0-stable has been updated
       via  a556145a2c973303fd70315d9b77f126f43638f0 (commit)
      from  b1f723c503b371776b2ae67a8cb78c8765387174 (commit)


- Log -----------------------------------------------------------------
commit a556145a2c973303fd70315d9b77f126f43638f0
Author: Roberto Guimaraes <rguimaraes at fastly.com>
Date:   Sun Feb 26 15:47:40 2017 -0800

    prevent undefined behavior when src and dst are equal
    
    CLA: trivial
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/2750)
    
    (cherry picked from commit 6aad9393680ccde591905c8d71da92a241756394)

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

Summary of changes:
 ssl/ssl_sess.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/ssl/ssl_sess.c b/ssl/ssl_sess.c
index 43cb1d3..3f06884 100644
--- a/ssl/ssl_sess.c
+++ b/ssl/ssl_sess.c
@@ -814,7 +814,8 @@ int SSL_SESSION_set1_id(SSL_SESSION *s, const unsigned char *sid,
       return 0;
     }
     s->session_id_length = sid_len;
-    memcpy(s->session_id, sid, sid_len);
+    if (sid != s->session_id)
+        memcpy(s->session_id, sid, sid_len);
     return 1;
 }
 
@@ -895,7 +896,8 @@ int SSL_SESSION_set1_id_context(SSL_SESSION *s, const unsigned char *sid_ctx,
         return 0;
     }
     s->sid_ctx_length = sid_ctx_len;
-    memcpy(s->sid_ctx, sid_ctx, sid_ctx_len);
+    if (sid_ctx != s->sid_ctx)
+        memcpy(s->sid_ctx, sid_ctx, sid_ctx_len);
 
     return 1;
 }


More information about the openssl-commits mailing list