[tor-commits] [tor/master] Turn base < 0 into a BUG() in our long-parse functions.

nickm at torproject.org nickm at torproject.org
Fri Jul 28 14:26:16 UTC 2017


commit accb734c5fc45481231b837cae1244129144df06
Author: Nick Mathewson <nickm at torproject.org>
Date:   Fri Jul 28 10:26:06 2017 -0400

    Turn base < 0 into a BUG() in our long-parse functions.
---
 src/common/util.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/common/util.c b/src/common/util.c
index 5b4702809..0858d17fe 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -1172,7 +1172,7 @@ tor_parse_long(const char *s, int base, long min, long max,
   char *endptr;
   long r;
 
-  if (base < 0) {
+  if (BUG(base < 0)) {
     if (ok)
       *ok = 0;
     return 0;
@@ -1191,7 +1191,7 @@ tor_parse_ulong(const char *s, int base, unsigned long min,
   char *endptr;
   unsigned long r;
 
-  if (base < 0) {
+  if (BUG(base < 0)) {
     if (ok)
       *ok = 0;
     return 0;
@@ -1223,7 +1223,7 @@ tor_parse_uint64(const char *s, int base, uint64_t min,
   char *endptr;
   uint64_t r;
 
-  if (base < 0) {
+  if (BUG(base < 0)) {
     if (ok)
       *ok = 0;
     return 0;



More information about the tor-commits mailing list