]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
resolve path weighting edge case; fixes bug 1203
authorRoger Dingledine <arma@torproject.org>
Wed, 13 Jan 2010 04:10:45 +0000 (23:10 -0500)
committerRoger Dingledine <arma@torproject.org>
Fri, 15 Jan 2010 20:56:54 +0000 (15:56 -0500)
src/or/routerlist.c

index 72b890b9fd8bd9d96e5f4dbc8acba556d074d438..d7546a7a8b82caebd0cf21233d58a914a77752f0 100644 (file)
@@ -1752,6 +1752,8 @@ smartlist_choose_by_bandwidth(smartlist_t *sl, bandwidth_weight_rule_t rule,
 
   /* Almost done: choose a random value from the bandwidth weights. */
   rand_bw = crypto_rand_uint64(total_bw);
+  rand_bw++; /* crypto_rand_uint64() counts from 0, and we need to count
+              * from 1 below. See bug 1203 for details. */
 
   /* Last, count through sl until we get to the element we picked */
   tmp = 0;