Avoid questionable use of the value of a pointer
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 20:57:59 +0000 (15:57 -0500)
that refers to space
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)
(cherry picked from commit 13ed1afa923f4ffb553e389de08f26e9ce84e8a2)

ssl/t1_lib.c

index acef270047908b5081244ae4c7432e3182ac7550..6587e8bb685c949dc694aeeed7665b0d8c53e5e3 100644 (file)
@@ -3577,10 +3577,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;
         }