From: Bodo Möller Date: Fri, 30 Dec 2005 23:51:57 +0000 (+0000) Subject: Rewrite timeout computation in a way that is less prone to overflow. X-Git-Tag: OpenSSL_0_9_8b~58 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=a14afd080498d06fe0c8a2c24c875d8559985bb6;p=oweals%2Fopenssl.git Rewrite timeout computation in a way that is less prone to overflow. (Problem reported by Peter Sylvester.) --- diff --git a/ssl/ssl_sess.c b/ssl/ssl_sess.c index da6b023c36..2f26593c70 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 */