From cfbb427c9d30023341f932cdf3f0a9346f3a8550 Mon Sep 17 00:00:00 2001 From: Nick Hibma Date: Sun, 7 May 2017 21:11:28 +0000 Subject: 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. --- sbin/dhclient/options.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sbin/dhclient/options.c') diff --git a/sbin/dhclient/options.c b/sbin/dhclient/options.c index be073dae39cd..fe025e6d6a40 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; -- cgit v1.2.3