svn commit: r236819 - head/sys/netinet/ipfw

Alexander V. Chernikov melifaro at FreeBSD.org
Sat Jun 9 17:39:05 UTC 2012


Author: melifaro
Date: Sat Jun  9 17:39:05 2012
New Revision: 236819
URL: http://svn.freebsd.org/changeset/base/236819

Log:
  Validate IPv4 network mask being passed to ipfw kernel interface.
  Incorrect mask can possibly be one of the reasons for kern/127209 existance.
  
  Approved by:        kib(mentor)
  MFC after:          3 days

Modified:
  head/sys/netinet/ipfw/ip_fw_table.c

Modified: head/sys/netinet/ipfw/ip_fw_table.c
==============================================================================
--- head/sys/netinet/ipfw/ip_fw_table.c	Sat Jun  9 16:44:35 2012	(r236818)
+++ head/sys/netinet/ipfw/ip_fw_table.c	Sat Jun  9 17:39:05 2012	(r236819)
@@ -153,6 +153,9 @@ ipfw_add_table_entry(struct ip_fw_chain 
 	case IPFW_TABLE_CIDR:
 		if (plen == sizeof(in_addr_t)) {
 #ifdef INET
+			/* IPv4 case */
+			if (mlen > 32)
+				return (EINVAL);
 			ent = malloc(sizeof(*ent), M_IPFW_TBL, M_WAITOK | M_ZERO);
 			ent->value = value;
 			/* Set 'total' structure length */


More information about the svn-src-all mailing list