summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-01-06 06:27:15 +0000
committerNick Mathewson <nickm@torproject.org>2007-01-06 06:27:15 +0000
commitd6073cc7fa63f69b8fd657ab38402f25ca06296f (patch)
tree42efd00124fa8b42930c180e29372ce4d42dea23 /src
parentaa7b72c97d803e982207376cd2a8f3e34f36ce52 (diff)
downloadtor-d6073cc7fa63f69b8fd657ab38402f25ca06296f.tar.gz
tor-d6073cc7fa63f69b8fd657ab38402f25ca06296f.zip
r11864@Kushana: nickm | 2007-01-06 01:25:59 -0500
Fix an XXXX012 in connection.c: prevent overflows on unfeasibly-high-bandwidth servers on 32-bit architectures. svn:r9282
Diffstat (limited to 'src')
-rw-r--r--src/or/connection.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/or/connection.c b/src/or/connection.c
index f42182ba6f..e4a03ac61b 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -1183,9 +1183,9 @@ global_write_bucket_low(size_t attempt, int priority)
if (priority == 1) { /* old-style v1 query */
/* Could we handle *two* of these requests within the next two seconds? */
- /* XXX012 make this robust against overflows */
- if (global_write_bucket + 2*(int)(get_options()->BandwidthRate) <
- 2*(int)attempt)
+ int64_t can_write = (int64_t)global_write_bucket
+ + 2*get_options()->BandwidthRate;
+ if (can_write < 2*(int64_t)attempt)
return 1;
} else { /* v2 query */
/* no further constraints yet */