diff options
author | Tom Cosgrove <tom@cvs.openbsd.org> | 2004-04-19 17:06:00 +0000 |
---|---|---|
committer | Tom Cosgrove <tom@cvs.openbsd.org> | 2004-04-19 17:06:00 +0000 |
commit | aa0e1b933d270310334a445b1d1b4f6790ed4310 (patch) | |
tree | 5356ebacf4b904032ffd726871aef2fe569025a5 /usr.sbin | |
parent | 79b87627ebab55889d21f0472a7ec0046ee333a7 (diff) |
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@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/dhcpd/dhcp.c | 6 |
1 files changed, 5 insertions, 1 deletions
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; |