summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortobias <tobias@openbsd.org>2014-08-11 18:41:13 +0000
committertobias <tobias@openbsd.org>2014-08-11 18:41:13 +0000
commit37eafab5d3aab79c981b973621731f8cc94fb13b (patch)
treefaa556d17be1824d7101c9d2fc6ec2683ea78617
parentvalidate len field for proper length, not just "not zero." (diff)
downloadwireguard-openbsd-37eafab5d3aab79c981b973621731f8cc94fb13b.tar.xz
wireguard-openbsd-37eafab5d3aab79c981b973621731f8cc94fb13b.zip
When parsing 32 bit values, verify that we received 4 bytes.
ok krw@
-rw-r--r--sbin/dhclient/dhclient.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c
index 7562a3e23a7..eca0134e8f6 100644
--- a/sbin/dhclient/dhclient.c
+++ b/sbin/dhclient/dhclient.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhclient.c,v 1.318 2014/07/13 14:50:03 krw Exp $ */
+/* $OpenBSD: dhclient.c,v 1.319 2014/08/11 18:41:13 tobias Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -2512,17 +2512,17 @@ set_lease_times(struct client_lease *lease)
* Take the server-provided times if available. Otherwise
* figure them out according to the spec.
*/
- if (lease->options[DHO_DHCP_LEASE_TIME].data)
+ if (lease->options[DHO_DHCP_LEASE_TIME].len == 4)
lease->expiry =
getULong(lease->options[DHO_DHCP_LEASE_TIME].data);
else
lease->expiry = DEFAULT_LEASE_TIME;
- if (lease->options[DHO_DHCP_RENEWAL_TIME].len)
+ if (lease->options[DHO_DHCP_RENEWAL_TIME].len == 4)
lease->renewal =
getULong(lease->options[DHO_DHCP_RENEWAL_TIME].data);
else
lease->renewal = lease->expiry / 2;
- if (lease->options[DHO_DHCP_REBINDING_TIME].len)
+ if (lease->options[DHO_DHCP_REBINDING_TIME].len == 4)
lease->rebind =
getULong(lease->options[DHO_DHCP_REBINDING_TIME].data);
else