Skip to content

Commit c0074b3

Browse files
author
cameronrich
committed
Fixed issue with session id's in the future
git-svn-id: svn://svn.code.sf.net/p/axtls/code/trunk@224 9a5d90b5-6617-0410-8a86-bb477d3ed2e3
1 parent 5fcb198 commit c0074b3

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

ssl/tls1.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,8 +1667,10 @@ SSL_SESSION *ssl_session_update(int max_sessions, SSL_SESSION *ssl_sessions[],
16671667
{
16681668
if (ssl_sessions[i])
16691669
{
1670-
/* kill off any expired sessions */
1671-
if (tm > ssl_sessions[i]->conn_time + SSL_EXPIRY_TIME)
1670+
/* kill off any expired sessions (including those in
1671+
the future) */
1672+
if ((tm > ssl_sessions[i]->conn_time + SSL_EXPIRY_TIME) ||
1673+
(tm < ssl_sessions[i]->conn_time))
16721674
{
16731675
session_free(ssl_sessions, i);
16741676
continue;
@@ -1712,13 +1714,9 @@ SSL_SESSION *ssl_session_update(int max_sessions, SSL_SESSION *ssl_sessions[],
17121714
}
17131715

17141716
/* ok, we've used up all of our sessions. So blow the oldest session away */
1715-
if (oldest_sess != NULL)
1716-
{
1717-
oldest_sess->conn_time = tm;
1718-
memset(oldest_sess->session_id, 0, sizeof(SSL_SESSION_ID_SIZE));
1719-
memset(oldest_sess->master_secret, 0, sizeof(SSL_SECRET_SIZE));
1720-
}
1721-
1717+
oldest_sess->conn_time = tm;
1718+
memset(oldest_sess->session_id, 0, sizeof(SSL_SESSION_ID_SIZE));
1719+
memset(oldest_sess->master_secret, 0, sizeof(SSL_SECRET_SIZE));
17221720
SSL_CTX_UNLOCK(ssl->ssl_ctx->mutex);
17231721
return oldest_sess;
17241722
}

0 commit comments

Comments
 (0)