Merge pull request #8615 from davidhorstmann-arm/fix-cast-potential-overflow
Fix possible integer overflows
This commit is contained in:
commit
f3ccfddb45
2 changed files with 4 additions and 2 deletions
|
@ -753,7 +753,8 @@ static int ssl_prepare_client_hello(mbedtls_ssl_context *ssl)
|
|||
session_negotiate->ticket != NULL) {
|
||||
mbedtls_ms_time_t now = mbedtls_ms_time();
|
||||
mbedtls_ms_time_t age = now - session_negotiate->ticket_reception_time;
|
||||
if (age < 0 || age > session_negotiate->ticket_lifetime * 1000) {
|
||||
if (age < 0 ||
|
||||
age > (mbedtls_ms_time_t) session_negotiate->ticket_lifetime * 1000) {
|
||||
/* Without valid ticket, disable session resumption.*/
|
||||
MBEDTLS_SSL_DEBUG_MSG(
|
||||
3, ("Ticket expired, disable session resumption"));
|
||||
|
|
|
@ -510,7 +510,8 @@ int mbedtls_ssl_ticket_parse(void *p_ticket,
|
|||
}
|
||||
#endif
|
||||
|
||||
mbedtls_ms_time_t ticket_lifetime = ctx->ticket_lifetime * 1000;
|
||||
mbedtls_ms_time_t ticket_lifetime =
|
||||
(mbedtls_ms_time_t) ctx->ticket_lifetime * 1000;
|
||||
|
||||
if (ticket_age < 0 || ticket_age > ticket_lifetime) {
|
||||
ret = MBEDTLS_ERR_SSL_SESSION_TICKET_EXPIRED;
|
||||
|
|
Loading…
Reference in a new issue