[tor-commits] [tor/master] Add an assertion to compute_weighted_bandwidths()
asn at torproject.org
asn at torproject.org
Thu Apr 18 10:23:55 UTC 2019
commit 96e310911fa14b8a8fb1861d08fbda7abe61eb10
Author: Nick Mathewson <nickm at torproject.org>
Date: Thu Apr 11 18:38:59 2019 -0400
Add an assertion to compute_weighted_bandwidths()
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 | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/feature/nodelist/node_select.c b/src/feature/nodelist/node_select.c
index e31abb247..93ddb066d 100644
--- a/src/feature/nodelist/node_select.c
+++ b/src/feature/nodelist/node_select.c
@@ -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);
More information about the tor-commits
mailing list