]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Tweak assertion in get_time_period_length() for coverity
authorNick Mathewson <nickm@torproject.org>
Fri, 20 Jul 2018 15:02:05 +0000 (11:02 -0400)
committerNick Mathewson <nickm@torproject.org>
Fri, 20 Jul 2018 15:02:07 +0000 (11:02 -0400)
This is another attempt to fix 1437668.  The assertion here should
be safe, since the rules of networkstatus_get_param() keep the value
it returns in range.

src/feature/hs/hs_common.c

index 328430be080d912d6289d01470b4377fd2c29855..1c5dfd5e639df84ed6bdaf2efb4102ae3ff4adde 100644 (file)
@@ -254,8 +254,8 @@ get_time_period_length(void)
                                              HS_TIME_PERIOD_LENGTH_MIN,
                                              HS_TIME_PERIOD_LENGTH_MAX);
   /* Make sure it's a positive value. */
-  tor_assert(time_period_length >= 0);
-  /* uint64_t will always be able to contain a int32_t */
+  tor_assert(time_period_length > 0);
+  /* uint64_t will always be able to contain a positive int32_t */
   return (uint64_t) time_period_length;
 }