]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Add an assertion to compute_weighted_bandwidths()
authorNick Mathewson <nickm@torproject.org>
Thu, 11 Apr 2019 22:38:59 +0000 (18:38 -0400)
committerNick Mathewson <nickm@torproject.org>
Thu, 11 Apr 2019 22:41:38 +0000 (18:41 -0400)
This should please coverity, and fix CID 1415722.  It didn't
understand that networkstatus_get_param() always returns a value
between its minimum and maximum values.

src/feature/nodelist/node_select.c

index e31abb247f9b8de97442536a9da87e593454accb..93ddb066d40df57255e0f5d005e76aeebf95c7bb 100644 (file)
@@ -585,6 +585,7 @@ compute_weighted_bandwidths(const smartlist_t *sl,
   }
 
   weight_scale = networkstatus_get_weight_scale_param(NULL);
+  tor_assert(weight_scale >= 1);
 
   if (rule == WEIGHT_FOR_GUARD) {
     Wg = networkstatus_get_bw_weight(NULL, "Wgg", -1);