[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Resolve a division-by-zero complaint from coverity. CID 1397272



commit 23c09b6bc2897ada21de220c48799f01171dcdf4
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Fri Dec 16 12:21:02 2016 -0500

    Resolve a division-by-zero complaint from coverity. CID 1397272
---
 src/or/entrynodes.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c
index 8715af7..2e46aba 100644
--- a/src/or/entrynodes.c
+++ b/src/or/entrynodes.c
@@ -638,7 +638,8 @@ choose_guard_selection(const or_options_t *options,
   */
 
   static int have_warned_extreme_threshold = 0;
-  if (n_passing_filter < extreme_threshold &&
+  if (n_guards &&
+      n_passing_filter < extreme_threshold &&
       ! have_warned_extreme_threshold) {
     have_warned_extreme_threshold = 1;
     const double exclude_frac =



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits