From: Bernd Edlinger Date: Wed, 22 Feb 2017 10:59:44 +0000 (+0100) Subject: Add some more consistency checks in tls_decrypt_ticket. X-Git-Tag: OpenSSL_1_1_0f~220 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=8aa38789332b49ef3d33965649a4595b1bc33ac9;p=oweals%2Fopenssl.git Add some more consistency checks in tls_decrypt_ticket. Reviewed-by: Richard Levitte Reviewed-by: Rich Salz (Merged from https://github.com/openssl/openssl/pull/2704) (cherry picked from commit 79020b27beff060d02830870fdfd821fe8cbd439) --- diff --git a/ssl/t1_lib.c b/ssl/t1_lib.c index b2688f6552..afee12d60d 100644 --- a/ssl/t1_lib.c +++ b/ssl/t1_lib.c @@ -3172,6 +3172,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