summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/dhclient.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/client/dhclient.c b/client/dhclient.c
index 580c7126..99f0ec1a 100644
--- a/client/dhclient.c
+++ b/client/dhclient.c
@@ -3070,8 +3070,15 @@ void script_write_params (client, prefix, lease)
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);