Turn base < 0 into a BUG() in our long-parse functions.

This commit is contained in:
Nick Mathewson 2017-07-28 10:26:06 -04:00
parent decb927685
commit accb734c5f

View File

@ -1172,7 +1172,7 @@ tor_parse_long(const char *s, int base, long min, long max,
char *endptr; char *endptr;
long r; long r;
if (base < 0) { if (BUG(base < 0)) {
if (ok) if (ok)
*ok = 0; *ok = 0;
return 0; return 0;
@ -1191,7 +1191,7 @@ tor_parse_ulong(const char *s, int base, unsigned long min,
char *endptr; char *endptr;
unsigned long r; unsigned long r;
if (base < 0) { if (BUG(base < 0)) {
if (ok) if (ok)
*ok = 0; *ok = 0;
return 0; return 0;
@ -1223,7 +1223,7 @@ tor_parse_uint64(const char *s, int base, uint64_t min,
char *endptr; char *endptr;
uint64_t r; uint64_t r;
if (base < 0) { if (BUG(base < 0)) {
if (ok) if (ok)
*ok = 0; *ok = 0;
return 0; return 0;