Browse Source

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

Eric Andersen 24 years ago
parent
commit
859354615b
1 changed files with 7 additions and 1 deletions
  1. 7 1
      libc/inet/addr.c

+ 7 - 1
libc/inet/addr.c

@@ -46,8 +46,14 @@ struct in_addr *inp;
 				return 0;
 				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;
 			return 0;
+		}
 
 
 		addr <<= 8;
 		addr <<= 8;
 		addr |= value;
 		addr |= value;