summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2006-07-14 03:17:49 +0000
committerRoger Dingledine <arma@torproject.org>2006-07-14 03:17:49 +0000
commit97c4d4d1760ca9f835ccde40a3bb11e835cdef5d (patch)
tree431cdfaccd327a04d8cb63b2424f1a3a265d45bd
parent96b03affcb32f659c15a1fe3bb13e9cc18369165 (diff)
downloadtor-97c4d4d1760ca9f835ccde40a3bb11e835cdef5d.tar.gz
tor-97c4d4d1760ca9f835ccde40a3bb11e835cdef5d.zip
Backport: Avoid an integer underflow when the dir authority decides
whether a router is stable. svn:r6759
-rw-r--r--src/or/dirserv.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index c80f426381..e85575e6f9 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -1193,7 +1193,10 @@ static uint32_t guard_bandwidth = 0;
static INLINE int
real_uptime(routerinfo_t *router, time_t now)
{
- return router->uptime + (now - router->cache_info.published_on);
+ if (now < router->cache_info.published_on)
+ return router->uptime;
+ else
+ return router->uptime + (now - router->cache_info.published_on);
}
/** Return 1 if <b>router</b> is not suitable for these parameters, else 0.