Use strtonum() instead of atoi(), strtol() or strtoul() where possible.

This commit is contained in:
Todd C. Miller
2013-12-10 16:23:21 -07:00
parent f83eac40eb
commit 8f9ce7249a
22 changed files with 227 additions and 200 deletions

View File

@@ -54,6 +54,7 @@ static int
check_addr(char *input)
{
int expected, matched;
const char *errstr;
size_t len;
char *cp;
@@ -65,7 +66,9 @@ check_addr(char *input)
cp = input + len;
while (isspace((unsigned char)*cp))
cp++;
expected = atoi(cp);
expected = strtonum(cp, 0, 1, &errstr);
if (errstr != NULL)
fatalx("expecting 0 or 1, got %s", cp);
input[len] = '\0';
matched = addr_matches(input);