diff options
author | Nick Mathewson <nickm@torproject.org> | 2016-12-07 11:14:56 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2016-12-07 11:14:56 -0500 |
commit | 2499ea359ab149343e10c38fb87ba903a0e8e049 (patch) | |
tree | 04f7c871dd284de5a7706747a9570e0b9750f881 /src/or/directory.c | |
parent | b0a842913acfb0de16ccb8ae358b6f6ee19d0898 (diff) | |
parent | 0815f96416676ace7cfdb5c29000d8cd6ee3459f (diff) | |
download | tor-2499ea359ab149343e10c38fb87ba903a0e8e049.tar.gz tor-2499ea359ab149343e10c38fb87ba903a0e8e049.zip |
Merge branch 'maint-0.2.9'
Diffstat (limited to 'src/or/directory.c')
-rw-r--r-- | src/or/directory.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/or/directory.c b/src/or/directory.c index 65ddd7d583..f0affbd395 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -3988,10 +3988,12 @@ STATIC int next_random_exponential_delay(int delay, int max_delay) { /* Check preconditions */ + if (BUG(max_delay < 0)) + max_delay = 0; if (BUG(delay > max_delay)) delay = max_delay; - if (BUG(delay == INT_MAX)) - delay -= 1; /* prevent overflow */ + if (delay == INT_MAX) + return INT_MAX; /* prevent overflow */ if (BUG(delay < 0)) delay = 0; |