summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;