From 859354615bd6505a2768f5f0020b5cba123bf166 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Thu, 20 Dec 2001 10:54:26 +0000 Subject: Steven Carr noticed that uClibc's inet_aton() is stricter then in glibc, since no trailing blanks was permitted, such that inet_aton("192.168.1.1 ",&value); would work with glibc, and fail with uClibc. This brings uClibc's inet_aton() behavior into sync with glibc's behavior. -Erik --- libc/inet/addr.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'libc') diff --git a/libc/inet/addr.c b/libc/inet/addr.c index 8feb77c62..15f6d0a5a 100644 --- a/libc/inet/addr.c +++ b/libc/inet/addr.c @@ -46,8 +46,14 @@ struct in_addr *inp; return 0; } - if (*cp++ != ((part == 4) ? '\0' : '.')) + if (part < 4) { + if (*cp++ != '.') + return 0; + } else { + char c = *cp++; + if (c != '\0' && !isspace(c)) return 0; + } addr <<= 8; addr |= value; -- cgit v1.2.3