Avoid buffer overflow
This commit is contained in:
parent
74fef68c8d
commit
8d71ef6bd4
2 changed files with 8 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ const char *invalid[] = {
|
|||
"192.168.1.1.",
|
||||
"192.168.1.1..",
|
||||
"192.168.1.1a",
|
||||
//"555555555555555555555555555555555555",
|
||||
"555555555555555555555555555555555555",
|
||||
"",
|
||||
NULL
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue