Use time_t for intermediate lease time values when calculating human
authorflorian <florian@openbsd.org>
Tue, 23 Mar 2021 17:46:20 +0000 (17:46 +0000)
committerflorian <florian@openbsd.org>
Tue, 23 Mar 2021 17:46:20 +0000 (17:46 +0000)
commit10c9b163136b7550e6b92b95338f5887e4f000b6
tree60b779bf92fad799990e9d7745d19df10f11bae8
parentc7e61995680257e5cac7323d52bb387f61e6dd90
Use time_t for intermediate lease time values when calculating human
readable output for very long timeouts to prevent overflow.
While here add years and days.
Days might actually show up in normal leases. Years is to catch
"infinity" which is encoded as UINT32_MAX and used by vmd(8).
Previously we would overflow, wrap to negative which then got
transformed to 0s.
Pointed out by Dave Voutila while working on the vmd(8) dhcp code.
usr.sbin/dhcpleasectl/dhcpleasectl.c