Avoid questionable use of the value of a pointer that refers to space
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Fri, 10 Mar 2017 14:10:41 +0000 (15:10 +0100)
committerRich Salz <rsalz@openssl.org>
Fri, 10 Mar 2017 19:07:53 +0000 (14:07 -0500)
deallocated by a call to the free function in tls_decrypt_ticket.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2897)

ssl/t1_lib.c

index afee12d60dccd92dba0017cf71c3060deae44177..e102c2480022e1ab8f5fb4cff9a13239e3d49a36 100644 (file)
@@ -3170,10 +3170,11 @@ static int tls_decrypt_ticket(SSL *s, const unsigned char *etick,
     p = sdec;
 
     sess = d2i_SSL_SESSION(NULL, &p, slen);
+    slen -= p - sdec;
     OPENSSL_free(sdec);
     if (sess) {
         /* Some additional consistency checks */
-        if (p != sdec + slen || sess->session_id_length != 0) {
+        if (slen != 0 || sess->session_id_length != 0) {
             SSL_SESSION_free(sess);
             return 2;
         }