aboutsummaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2009-04-21 00:41:57 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2009-04-21 00:41:57 +0000
commit76478b8091d4c3472fb0c7e572c350d150ecd459 (patch)
tree1353dc1a9eee47777a6e7a8ece6d056d2d38ce92 /networking
parent0ad82344743e990e6985a8ee1b39a85fc4126084 (diff)
downloadbusybox-w32-76478b8091d4c3472fb0c7e572c350d150ecd459.tar.gz
busybox-w32-76478b8091d4c3472fb0c7e572c350d150ecd459.tar.bz2
busybox-w32-76478b8091d4c3472fb0c7e572c350d150ecd459.zip
udhcpc: fix truncation of last char in client hostnames
Diffstat (limited to 'networking')
-rw-r--r--networking/udhcp/leases.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/networking/udhcp/leases.c b/networking/udhcp/leases.c
index 6e1398d2f..e17fb9e3f 100644
--- a/networking/udhcp/leases.c
+++ b/networking/udhcp/leases.c
@@ -63,7 +63,8 @@ struct dhcpOfferedAddr* FAST_FUNC add_lease(
63 if (oldest) { 63 if (oldest) {
64 oldest->hostname[0] = '\0'; 64 oldest->hostname[0] = '\0';
65 if (hostname) { 65 if (hostname) {
66 hostname_length = hostname[-1]; /* look at option size byte */ 66 /* option size byte, + 1 for NUL */
67 hostname_length = hostname[-1] + 1;
67 if (hostname_length > sizeof(oldest->hostname)) 68 if (hostname_length > sizeof(oldest->hostname))
68 hostname_length = sizeof(oldest->hostname); 69 hostname_length = sizeof(oldest->hostname);
69 hostname = (uint8_t*) safe_strncpy((char*)oldest->hostname, (char*)hostname, hostname_length); 70 hostname = (uint8_t*) safe_strncpy((char*)oldest->hostname, (char*)hostname, hostname_length);