summaryrefslogtreecommitdiffstats
path: root/sbin/dhclient/options.c
diff options
context:
space:
mode:
authorn_hibma <n_hibma@FreeBSD.org>2017-05-22 10:28:17 +0000
committern_hibma <n_hibma@FreeBSD.org>2017-05-22 10:28:17 +0000
commit1f2961e6aa280c022a8e33b13e4364467dd0b009 (patch)
treef2b66c2c879c11e56e22c4ae6934e8abcfcda534 /sbin/dhclient/options.c
parent23dcad981553a6eed093a676a47643e37b8de63b (diff)
downloadFreeBSD-src-1f2961e6aa280c022a8e33b13e4364467dd0b009.zip
FreeBSD-src-1f2961e6aa280c022a8e33b13e4364467dd0b009.tar.gz
MFC:
------------------------------------------------------------------------ r317923 | n_hibma | 2017-05-07 23:11:28 +0200 (Sun, 07 May 2017) | 8 lines Fix the output of very large rebind, renew and lease time options in lease file. Some routers set very large values for rebind time (Netgear) and these are erroneously reported as negative in the leasefile. This was due to a wrong printf format specification of %ld for an unsigned long on 32-bit platforms. ------------------------------------------------------------------------ r317915 | n_hibma | 2017-05-07 21:59:37 +0200 (Sun, 07 May 2017) | 16 lines Fix handling of large DHCP expiry values. They would overflow a signed 32-bit time_t on 32 bit architectures. This was taken care of, but a compiler optimisation makes this behave erratically. This could be resolved by adding a -fwrapv flag, but instead we can check the value before adding the current timestamp to it. In the lease file values are still wrong though: option dhcp-rebinding-time -644245096; PR: 218980
Diffstat (limited to 'sbin/dhclient/options.c')
-rw-r--r--sbin/dhclient/options.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sbin/dhclient/options.c b/sbin/dhclient/options.c
index be073da..fe025e6 100644
--- a/sbin/dhclient/options.c
+++ b/sbin/dhclient/options.c
@@ -783,7 +783,7 @@ pretty_print_option(unsigned int code, unsigned char *data, int len,
dp += 4;
break;
case 'L':
- opcount = snprintf(op, opleft, "%ld",
+ opcount = snprintf(op, opleft, "%lu",
(unsigned long)getULong(dp));
if (opcount >= opleft || opcount == -1)
goto toobig;
@@ -799,7 +799,7 @@ pretty_print_option(unsigned int code, unsigned char *data, int len,
dp += 2;
break;
case 'S':
- opcount = snprintf(op, opleft, "%d",
+ opcount = snprintf(op, opleft, "%u",
getUShort(dp));
if (opcount >= opleft || opcount == -1)
goto toobig;
OpenPOWER on IntegriCloud