summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko2009-04-21 00:41:57 +0000
committerDenis Vlasenko2009-04-21 00:41:57 +0000
commit76478b8091d4c3472fb0c7e572c350d150ecd459 (patch)
tree1353dc1a9eee47777a6e7a8ece6d056d2d38ce92
parent0ad82344743e990e6985a8ee1b39a85fc4126084 (diff)
downloadbusybox-76478b8091d4c3472fb0c7e572c350d150ecd459.zip
busybox-76478b8091d4c3472fb0c7e572c350d150ecd459.tar.gz
udhcpc: fix truncation of last char in client hostnames
-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 6e1398d..e17fb9e 100644
--- a/networking/udhcp/leases.c
+++ b/networking/udhcp/leases.c
@@ -63,7 +63,8 @@ struct dhcpOfferedAddr* FAST_FUNC add_lease(
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);