From: Denis Vlasenko Date: Tue, 21 Apr 2009 00:41:57 +0000 (-0000) Subject: udhcpc: fix truncation of last char in client hostnames X-Git-Tag: 1_15_0~301 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=76478b8091d4c3472fb0c7e572c350d150ecd459;p=oweals%2Fbusybox.git udhcpc: fix truncation of last char in client hostnames --- 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( 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);