svn commit: r317923 - head/sbin/dhclient

Nick Hibma n_hibma at FreeBSD.org
Sun May 7 21:11:30 UTC 2017


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;


More information about the svn-src-all mailing list