Add some more consistency checks in tls_decrypt_ticket.
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Wed, 22 Feb 2017 10:59:44 +0000 (11:59 +0100)
committerRich Salz <rsalz@openssl.org>
Wed, 22 Feb 2017 14:43:42 +0000 (09:43 -0500)
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2704)
(cherry picked from commit 79020b27beff060d02830870fdfd821fe8cbd439)

ssl/t1_lib.c

index d07a9f0e837043f4db2ead8b90bf5cc11a89ced1..acef270047908b5081244ae4c7432e3182ac7550 100644 (file)
@@ -3579,6 +3579,11 @@ static int tls_decrypt_ticket(SSL *s, const unsigned char *etick,
     sess = d2i_SSL_SESSION(NULL, &p, slen);
     OPENSSL_free(sdec);
     if (sess) {
+        /* Some additional consistency checks */
+        if (p != sdec + slen || sess->session_id_length != 0) {
+            SSL_SESSION_free(sess);
+            return 2;
+        }
         /*
          * The session ID, if non-empty, is used by some clients to detect
          * that the ticket has been accepted. So we copy it to the session