From d4b5d6e98160b3c76b37fef1b0581c3b9a7cd192 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Wed, 20 Apr 2011 20:00:59 -0400 Subject: [PATCH] fix bugs in ipv4 parsing --- src/network/__ipparse.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/network/__ipparse.c b/src/network/__ipparse.c index ca9e5890..604bdc2f 100644 --- a/src/network/__ipparse.c +++ b/src/network/__ipparse.c @@ -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) { -- 2.25.1