mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
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 svn:r6758
This commit is contained in:
+4
-1
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user