From 28af501cae7f74a352c9b4f0ab5b41768f653a8c Mon Sep 17 00:00:00 2001 From: Xiaokang Qian Date: Thu, 13 Oct 2022 08:18:19 +0000 Subject: [PATCH] Fix the ticket_lifetime equal to 0 issue Signed-off-by: Xiaokang Qian --- library/ssl_tls13_server.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/ssl_tls13_server.c b/library/ssl_tls13_server.c index 61a1bad578..c8a7827501 100644 --- a/library/ssl_tls13_server.c +++ b/library/ssl_tls13_server.c @@ -2848,7 +2848,8 @@ static int ssl_tls13_write_new_session_ticket_body( mbedtls_ssl_context *ssl, * MAY treat a ticket as valid for a shorter period of time than what * is stated in the ticket_lifetime. */ - ticket_lifetime %= 604800; + if( ticket_lifetime > 604800 ) + ticket_lifetime = 604800; MBEDTLS_PUT_UINT32_BE( ticket_lifetime, p, 0 ); MBEDTLS_SSL_DEBUG_MSG( 3, ( "ticket_lifetime: %u", ( unsigned int )ticket_lifetime ) );