iscidraddr: return 0 for 127.0.0.1/322
This commit is contained in:
parent
0c1b951771
commit
82693b4d5e
2 changed files with 2 additions and 1 deletions
|
@ -23,7 +23,7 @@ iscidraddr(const char *str)
|
|||
char addr[offset], cidr[3];
|
||||
char *c = (char*)&str[offset + 1];
|
||||
memcpy(addr, str, offset);
|
||||
memcpy(cidr, c, 2);
|
||||
memcpy(cidr, c, 3);
|
||||
addr[offset] = '\0';
|
||||
return isinetaddr(addr) && in_range(cidr, 0, 32);
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ const char *invalid[] = {
|
|||
/* invalid cidr notation */
|
||||
"10.0.0.1/33", "127.0.0.1/64",
|
||||
"127.0.0.1/", "127.0.0.1/a",
|
||||
"127.0.0.1/322",
|
||||
"/", "/123.","127/2",
|
||||
/* edge cases */
|
||||
"555555555555555555555555555555555555",
|
||||
|
|
Loading…
Reference in a new issue