Sophie

Sophie

distrib > Mandriva > 2009.0 > x86_64 > media > main-testing-src > by-pkgid > d9da1cc217400f6c4d82193d24fc7d10 > files > 5

dhcp-3.0.7-1.5mdv2009.0.src.rpm

--- client/dhclient.c	2008-01-22 18:28:23.000000000 +0100
+++ client/dhclient.c.oden	2009-07-15 00:22:19.000000000 +0200
@@ -2512,8 +2512,15 @@ void script_write_params (client, prefix
 		if (data.len > 3) {
 			struct iaddr netmask, subnet, broadcast;
 
-			memcpy (netmask.iabuf, data.data, data.len);
-			netmask.len = data.len;
+			/*
+			 * No matter the length of the subnet-mask option,
+			 * use only the first four octets.  Note that
+			 * subnet-mask options longer than 4 octets are not
+			 * in conformance with RFC 2132, but servers with this
+			 * flaw do exist.
+			 */
+			memcpy(netmask.iabuf, data.data, 4);
+			netmask.len = 4;
 			data_string_forget (&data, MDL);
 
 			subnet = subnet_number (lease -> address, netmask);