aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Færøy <ahf@torproject.org>2018-07-11 16:19:56 +0200
committerAlexander Færøy <ahf@torproject.org>2018-07-13 12:43:57 +0200
commitc9de65f96685fd54029f284a043cefd970061956 (patch)
tree8b2d7e25250982fa42fcde98aa9cf67d15a29807
parentd2bd358924802b2bf0f3ecf8fb73aae83382a3df (diff)
downloadtor-c9de65f96685fd54029f284a043cefd970061956.tar.gz
tor-c9de65f96685fd54029f284a043cefd970061956.zip
Add checks in get_net_param_from_list() for valid output domain.
This patch adds two assertions in get_net_param_from_list() to ensure that the `res` value is correctly within the range of the output domain. Hopefully fixes Coverity CID #1415721, #1415722, and #1415723. See: https://bugs.torproject.org/26780
-rw-r--r--src/feature/nodelist/networkstatus.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/feature/nodelist/networkstatus.c b/src/feature/nodelist/networkstatus.c
index e9d36cbdcb..f8623f826c 100644
--- a/src/feature/nodelist/networkstatus.c
+++ b/src/feature/nodelist/networkstatus.c
@@ -2417,6 +2417,8 @@ get_net_param_from_list(smartlist_t *net_params, const char *param_name,
res = max_val;
}
+ tor_assert(res >= min_val);
+ tor_assert(res <= max_val);
return res;
}