Avoid buffer overflow

This commit is contained in:
0x1eef 2023-08-25 18:37:53 -03:00
parent 74fef68c8d
commit 8d71ef6bd4
2 changed files with 8 additions and 4 deletions

View file

@ -32,9 +32,13 @@ isinetaddr(const char *str)
return 0;
}
} else if (isdigit(str[l])) {
buf[k++] = str[l];
buf[k] = '\0';
i++;
if (k == 3) {
return 0;
} else {
buf[k++] = str[l];
buf[k] = '\0';
i++;
}
} else {
return 0;
}

View file

@ -17,7 +17,7 @@ const char *invalid[] = {
"192.168.1.1.",
"192.168.1.1..",
"192.168.1.1a",
//"555555555555555555555555555555555555",
"555555555555555555555555555555555555",
"",
NULL
};