diff options
-rw-r--r-- | usr/klibc/inet/inet_pton.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/usr/klibc/inet/inet_pton.c b/usr/klibc/inet/inet_pton.c index a319506abd390..19706ce03646b 100644 --- a/usr/klibc/inet/inet_pton.c +++ b/usr/klibc/inet/inet_pton.c @@ -32,7 +32,7 @@ int inet_pton(int af, const char *src, void *dst) case AF_INET6: { struct in6_addr *d = (struct in6_addr *)dst; - int colons = 0, dcolons = 0; + int colons = 0, dcolons = 0, digits = 0; int i; const char *p; @@ -43,7 +43,9 @@ int inet_pton(int af, const char *src, void *dst) colons++; if (p[1] == ':') dcolons++; - } else if (!isxdigit((unsigned char)*p)) + digits = 0; + } else if (!isxdigit((unsigned char)*p) + || ++digits > 4) return 0; /* Invalid address */ } |