From aa0e1b933d270310334a445b1d1b4f6790ed4310 Mon Sep 17 00:00:00 2001 From: Tom Cosgrove Date: Mon, 19 Apr 2004 17:06:00 +0000 Subject: Catch negative lease times. From openbsd@nerd-marrow.com in PR 2888, which this closes (though the PR was for usr.sbin/dhcpd/server/). ok henning@ --- usr.sbin/dhcpd/dhcp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/usr.sbin/dhcpd/dhcp.c b/usr.sbin/dhcpd/dhcp.c index 40e934771db..9a5ca70cb62 100644 --- a/usr.sbin/dhcpd/dhcp.c +++ b/usr.sbin/dhcpd/dhcp.c @@ -740,8 +740,12 @@ ack_lease(struct packet *packet, struct lease *lease, unsigned int offer, /* * Don't let the client ask for a longer lease than * is supported for this subnet or host. + * + * time_t is signed, so really large numbers come + * back as negative. Don't allow lease_time of 0, + * either. */ - if (lease_time > max_lease_time) + if (lease_time < 1 || lease_time > max_lease_time) lease_time = max_lease_time; } else lease_time = default_lease_time; -- cgit v1.2.3