svn commit: [26171] trunk/busybox/networking/udhcp

vda at busybox.net vda at busybox.net
Tue Apr 21 00:41:57 UTC 2009


Author: vda
Date: 2009-04-21 00:41:57 +0000 (Tue, 21 Apr 2009)
New Revision: 26171

Log:
udhcpc: fix truncation of last char in client hostnames



Modified:
   trunk/busybox/networking/udhcp/leases.c


Changeset:
Modified: trunk/busybox/networking/udhcp/leases.c
===================================================================
--- trunk/busybox/networking/udhcp/leases.c	2009-04-21 00:29:17 UTC (rev 26170)
+++ trunk/busybox/networking/udhcp/leases.c	2009-04-21 00:41:57 UTC (rev 26171)
@@ -63,7 +63,8 @@
 	if (oldest) {
 		oldest->hostname[0] = '\0';
 		if (hostname) {
-        		hostname_length = hostname[-1]; /* look at option size byte */
+			/* option size byte, + 1 for NUL */
+        		hostname_length = hostname[-1] + 1;
 			if (hostname_length > sizeof(oldest->hostname))
 				hostname_length = sizeof(oldest->hostname);
             		hostname = (uint8_t*) safe_strncpy((char*)oldest->hostname, (char*)hostname, hostname_length);



More information about the busybox-cvs mailing list