summaryrefslogtreecommitdiff
path: root/libc/inet/addr.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-12-20 10:54:26 +0000
committerEric Andersen <andersen@codepoet.org>2001-12-20 10:54:26 +0000
commit859354615bd6505a2768f5f0020b5cba123bf166 (patch)
treeca6c5666e9608f18d97f5064d1b5b28aaa74b9dc /libc/inet/addr.c
parent16fa65662a4569bd297f4f39e48006ac2103b355 (diff)
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
Diffstat (limited to 'libc/inet/addr.c')
-rw-r--r--libc/inet/addr.c8
1 files changed, 7 insertions, 1 deletions
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;