]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix an always-false check with an assertion
authorNick Mathewson <nickm@torproject.org>
Tue, 1 Sep 2015 13:52:46 +0000 (09:52 -0400)
committerNick Mathewson <nickm@torproject.org>
Tue, 1 Sep 2015 13:52:46 +0000 (09:52 -0400)
In validate_recommended_package_line, at this point in the function,
n_entries is always >= 1.  Coverity doesn't like us checking it for
0.

CID 1268063.

src/or/dirserv.c

index 58ab009cbf0dba47f343258c08c4a884a166fc2c..2e5766aa1437d79d908fd1babd4d1aa20861ef38 100644 (file)
@@ -3745,7 +3745,9 @@ validate_recommended_package_line(const char *line)
     cp = end_of_word + 1;
   }
 
-  return (n_entries == 0) ? 0 : 1;
+  /* If we reach this point, we have at least 1 entry. */
+  tor_assert(n_entries > 0)
+  return 1;
 }
 
 /** Release all storage used by the directory server. */