about summary refs log tree commit diff
path: root/resolv
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-03-05 14:32:11 +0000
committerUlrich Drepper <drepper@redhat.com>1999-03-05 14:32:11 +0000
commitad792af765438804272da2cc9e268e06e190c578 (patch)
tree6205dc4883c074c5efb9b404d1905a4d1c46e815 /resolv
parent346af50a0857a27e5c133be2ad7ac6e074f85f51 (diff)
downloadglibc-ad792af765438804272da2cc9e268e06e190c578.tar.gz
glibc-ad792af765438804272da2cc9e268e06e190c578.tar.xz
glibc-ad792af765438804272da2cc9e268e06e190c578.zip
Update.
1999-03-05  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* resolv/inet_addr.c (inet_aton): Don't allow componets >
	255. Patch by Bruno Haible <haible@ilog.fr> [PR libc/1010].
Diffstat (limited to 'resolv')
-rw-r--r--resolv/inet_addr.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/resolv/inet_addr.c b/resolv/inet_addr.c
index 0d3ba068d5..a5667eb6ed 100644
--- a/resolv/inet_addr.c
+++ b/resolv/inet_addr.c
@@ -187,19 +187,20 @@ inet_aton(cp, addr)
 		break;
 
 	case 2:				/* a.b -- 8.24 bits */
-		if (val > 0xffffff)
+		if (parts[0] > 0xff || val > 0xffffff)
 			goto ret_0;
 		val |= parts[0] << 24;
 		break;
 
 	case 3:				/* a.b.c -- 8.8.16 bits */
-		if (val > 0xffff)
+		if (parts[0] > 0xff || parts[1] > 0xff || val > 0xffff)
 			goto ret_0;
 		val |= (parts[0] << 24) | (parts[1] << 16);
 		break;
 
 	case 4:				/* a.b.c.d -- 8.8.8.8 bits */
-		if (val > 0xff)
+		if (parts[0] > 0xff || parts[1] > 0xff || parts[2] > 0xff
+		    || val > 0xff)
 			goto ret_0;
 		val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
 		break;