[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] Avoid an integer underflow when the dir authority decides w...
Update of /home2/or/cvsroot/tor/src/or
In directory moria:/home/arma/work/onion/cvs/tor/src/or
Modified Files:
dirserv.c
Log Message:
Avoid an integer underflow when the dir authority decides whether a
router is stable: we might wrongly label it stable, and compute a slightly
wrong median stability, when a descriptor is published later than now.
Inspired by Matt's Vidalia checkin:
http://trac.vidalia-project.net/changeset/1074
Index: dirserv.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/dirserv.c,v
retrieving revision 1.354
retrieving revision 1.355
diff -u -p -d -r1.354 -r1.355
--- dirserv.c 6 Jul 2006 02:45:46 -0000 1.354
+++ dirserv.c 14 Jul 2006 03:14:02 -0000 1.355
@@ -1227,7 +1227,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.