fix bugs in ipv4 parsing

This commit is contained in:
Rich Felker 2011-04-20 20:00:59 -04:00
parent 29a15ad077
commit d4b5d6e981

View File

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