aboutsummaryrefslogtreecommitdiff
path: root/ssl/ssl_sess.c
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>2005-12-30 23:51:36 +0000
committerBodo Möller <bodo@openssl.org>2005-12-30 23:51:36 +0000
commit7476f3ac3bdbcfb4f73317d28aed35740fc74287 (patch)
tree6b461710e994d02d502621c93c4fc3c7556ca77d /ssl/ssl_sess.c
parent68b64fb6102737bf84de9e25168abbf7e969b54b (diff)
downloadopenssl-7476f3ac3bdbcfb4f73317d28aed35740fc74287.zip
openssl-7476f3ac3bdbcfb4f73317d28aed35740fc74287.tar.gz
openssl-7476f3ac3bdbcfb4f73317d28aed35740fc74287.tar.bz2
Rewrite timeout computation in a way that is less prone to overflow.
(Problem reported by Peter Sylvester.)
Diffstat (limited to 'ssl/ssl_sess.c')
-rw-r--r--ssl/ssl_sess.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ssl/ssl_sess.c b/ssl/ssl_sess.c
index 5286964..7a4bb92 100644
--- a/ssl/ssl_sess.c
+++ b/ssl/ssl_sess.c
@@ -389,7 +389,7 @@ int ssl_get_prev_session(SSL *s, unsigned char *session_id, int len)
CRYPTO_add(&ret->references,1,CRYPTO_LOCK_SSL_SESSION);
#endif
- if ((long)(ret->time+ret->timeout) < (long)time(NULL)) /* timeout */
+ if (ret->timeout < (long)(time(NULL) - ret->time)) /* timeout */
{
s->ctx->stats.sess_timeout++;
/* remove it from the cache */