]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Add checks in get_net_param_from_list() for valid output domain.
authorAlexander Færøy <ahf@torproject.org>
Wed, 11 Jul 2018 14:19:56 +0000 (16:19 +0200)
committerAlexander Færøy <ahf@torproject.org>
Fri, 13 Jul 2018 10:43:57 +0000 (12:43 +0200)
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

src/feature/nodelist/networkstatus.c

index e9d36cbdcba6392c82d270fb9eb5874ab278d1ea..f8623f826ca9716ceb84bc3ce2265c798309ef22 100644 (file)
@@ -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;
 }