Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 7 May 2017 21:11:28 +0000 (UTC)
From:      Nick Hibma <n_hibma@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r317923 - head/sbin/dhclient
Message-ID:  <201705072111.v47LBSl6045540@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: n_hibma
Date: Sun May  7 21:11:28 2017
New Revision: 317923
URL: https://svnweb.freebsd.org/changeset/base/317923

Log:
  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.

Modified:
  head/sbin/dhclient/options.c

Modified: head/sbin/dhclient/options.c
==============================================================================
--- head/sbin/dhclient/options.c	Sun May  7 21:06:23 2017	(r317922)
+++ head/sbin/dhclient/options.c	Sun May  7 21:11:28 2017	(r317923)
@@ -783,7 +783,7 @@ pretty_print_option(unsigned int code, u
 				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, u
 				dp += 2;
 				break;
 			case 'S':
-				opcount = snprintf(op, opleft, "%d",
+				opcount = snprintf(op, opleft, "%u",
 				    getUShort(dp));
 				if (opcount >= opleft || opcount == -1)
 					goto toobig;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201705072111.v47LBSl6045540>