svn commit: r186226 - stable/6/lib/libc/inet

Hajimu UMEMOTO ume at FreeBSD.org
Wed Dec 17 06:21:50 PST 2008


Author: ume
Date: Wed Dec 17 14:21:49 2008
New Revision: 186226
URL: http://svn.freebsd.org/changeset/base/186226

Log:
  MFC 186090
  
  inet_net_pton() can sometimes return the wrong value if excessively
  large netmasks are supplied. [RT #18512]
  
  Reported by:	Maksymilian Arciemowicz <cxib__at__securityreason.com>
  Obtained from:	BIND 9.4.3

Modified:
  stable/6/lib/libc/inet/inet_net_pton.c   (contents, props changed)

Modified: stable/6/lib/libc/inet/inet_net_pton.c
==============================================================================
--- stable/6/lib/libc/inet/inet_net_pton.c	Wed Dec 17 13:13:35 2008	(r186225)
+++ stable/6/lib/libc/inet/inet_net_pton.c	Wed Dec 17 14:21:49 2008	(r186226)
@@ -135,11 +135,11 @@ inet_net_pton_ipv4(const char *src, u_ch
 			assert(n >= 0 && n <= 9);
 			bits *= 10;
 			bits += n;
+			if (bits > 32)
+				goto enoent;
 		} while ((ch = *src++) != '\0' && isascii(ch) && isdigit(ch));
 		if (ch != '\0')
 			goto enoent;
-		if (bits > 32)
-			goto emsgsize;
 	}
 
 	/* Firey death and destruction unless we prefetched EOS. */


More information about the svn-src-stable mailing list