aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-08-03 11:46:03 -0400
committerNick Mathewson <nickm@torproject.org>2012-08-03 11:46:03 -0400
commit860c4fc81166568f2909708c455ca6a70d81a2f8 (patch)
treef2fa7e5701dd066ec8d2662857ef1e217e7d3436
parent6c64681879cca488c2cc017b99ed1e7104da5049 (diff)
parent82c5e385cbddec4fd80618d6e96111ad73d5a22e (diff)
downloadtor-860c4fc81166568f2909708c455ca6a70d81a2f8.tar
tor-860c4fc81166568f2909708c455ca6a70d81a2f8.tar.gz
Merge remote-tracking branch 'origin/maint-0.2.3'
-rw-r--r--src/or/routerlist.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index c96a7268b..e8365d03c 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -1985,9 +1985,10 @@ smartlist_choose_node_by_bandwidth(smartlist_t *sl,
if (is_guard)
bitarray_set(guard_bits, i);
if (is_known) {
- bandwidths[i] = (int32_t) this_bw; // safe since MAX_BELIEVABLE<INT32_MAX
- // XXX this is no longer true! We don't always cap the bw anymore. Can
- // a consensus make us overflow?-sh
+ bandwidths[i] = (int32_t) this_bw;
+ /* Casting this_bw to int32_t is safe because both kb_to_bytes
+ and bridge_get_advertised_bandwidth_bounded limit it to below
+ INT32_MAX. */
tor_assert(bandwidths[i] >= 0);
if (is_guard)
total_guard_bw += this_bw;