Fix cidr edge cases
This commit is contained in:
parent
97a2f8f42e
commit
1ab5387ff0
1 changed files with 6 additions and 2 deletions
|
@ -35,6 +35,10 @@ in_range(char buf[4], int min, int max)
|
||||||
char *err;
|
char *err;
|
||||||
long r;
|
long r;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
r = strtol(buf, &err, 10);
|
if (strnlen(buf, 1) == 0) {
|
||||||
return *err == '\0' && errno == 0 && (r >= min && r <= max);
|
return 0;
|
||||||
|
} else {
|
||||||
|
r = strtol(buf, &err, 10);
|
||||||
|
return *err == '\0' && errno == 0 && (r >= min && r <= max);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue