aboutsummaryrefslogtreecommitdiff
path: root/src/feature/relay/onion_queue.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-04-11 18:38:59 -0400
committerNick Mathewson <nickm@torproject.org>2019-04-11 18:44:10 -0400
commit66b07e7ec13feb57d696b920493590d232e62763 (patch)
tree061288d7304edbd86a0445f9bdb7d35d52cc909d /src/feature/relay/onion_queue.c
parent96e310911fa14b8a8fb1861d08fbda7abe61eb10 (diff)
downloadtor-66b07e7ec13feb57d696b920493590d232e62763.tar.gz
tor-66b07e7ec13feb57d696b920493590d232e62763.zip
Add an assertion to num_ntors_per_tap().
This should please coverity, and fix CID 1415721. It didn't understand that networkstatus_get_param() always returns a value between its minimum and maximum values.
Diffstat (limited to 'src/feature/relay/onion_queue.c')
-rw-r--r--src/feature/relay/onion_queue.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/feature/relay/onion_queue.c b/src/feature/relay/onion_queue.c
index 696905cf5e..c37745cf33 100644
--- a/src/feature/relay/onion_queue.c
+++ b/src/feature/relay/onion_queue.c
@@ -212,10 +212,12 @@ num_ntors_per_tap(void)
#define MIN_NUM_NTORS_PER_TAP 1
#define MAX_NUM_NTORS_PER_TAP 100000
- return networkstatus_get_param(NULL, "NumNTorsPerTAP",
- DEFAULT_NUM_NTORS_PER_TAP,
- MIN_NUM_NTORS_PER_TAP,
- MAX_NUM_NTORS_PER_TAP);
+ int result = networkstatus_get_param(NULL, "NumNTorsPerTAP",
+ DEFAULT_NUM_NTORS_PER_TAP,
+ MIN_NUM_NTORS_PER_TAP,
+ MAX_NUM_NTORS_PER_TAP);
+ tor_assert(result > 0);
+ return result;
}
/** Choose which onion queue we'll pull from next. If one is empty choose