Small tweak

This commit is contained in:
0x1eef 2023-08-25 18:58:59 -03:00
parent 8d71ef6bd4
commit 918d43e4e9
2 changed files with 3 additions and 3 deletions

View file

@ -21,7 +21,7 @@ isinetaddr(const char *str)
int i = 0, j = 0, k = 0;
size_t len = (str == NULL ? 0 : strnlen(str, 16));
for(size_t l = 0; l < len; l++) {
for (size_t l = 0; l < len; l++) {
if (str[l] == '.') {
if (inrange(buf)) {
k = 0;

View file

@ -27,7 +27,7 @@ main(void) {
size_t len;
/* IPv4: valid */
len = sizeof(valid) / sizeof(valid[0]);
for(size_t i = 0; i < len; i++) {
for (size_t i = 0; i < len; i++) {
if (isinetaddr(valid[i]) != 1) {
fprintf(stderr, "assertion failed: '%s' should be valid\n", valid[i]);
abort();
@ -35,7 +35,7 @@ main(void) {
}
/* IPv4: invalid */
len = sizeof(invalid) / sizeof(invalid[0]);
for(size_t i = 0; i < len; i++) {
for (size_t i = 0; i < len; i++) {
if (isinetaddr(invalid[i]) != 0) {
fprintf(stderr, "assertion failed: '%s' should NOT be valid\n", invalid[i]);
abort();