From 37eafab5d3aab79c981b973621731f8cc94fb13b Mon Sep 17 00:00:00 2001 From: tobias Date: Mon, 11 Aug 2014 18:41:13 +0000 Subject: [PATCH] When parsing 32 bit values, verify that we received 4 bytes. ok krw@ --- sbin/dhclient/dhclient.c | 8 ++++---- 1 file 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 @@ -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 -- 2.20.1