diff --git a/src/iscidraddr.c b/src/iscidraddr.c index 3d889bd..fbea53f 100644 --- a/src/iscidraddr.c +++ b/src/iscidraddr.c @@ -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); } diff --git a/test/iscidraddr_test.c b/test/iscidraddr_test.c index 95440fb..ed674e2 100644 --- a/test/iscidraddr_test.c +++ b/test/iscidraddr_test.c @@ -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",