fix bugs in ipv4 parsing

This commit is contained in:
Rich Felker 2011-04-20 20:00:59 -04:00
parent 29a15ad077
commit d4b5d6e981
1 changed files with 2 additions and 1 deletions

View File

@ -14,9 +14,10 @@ int __ipparse(void *dest, int family, const char *s)
if (family == AF_INET6) goto not_v4;
for (i=0; i<4 && *s; i++) {
for (i=0; i<4; i++) {
a[i] = strtoul(s, (char **)&z, 0);
if (z==s || (*z && *z != '.')) goto not_v4;
if (!*z) break;
s=z+1;
}
switch (i) {