udhcpc: fix truncation of last char in client hostnames
This commit is contained in:
parent
0ad8234474
commit
76478b8091
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user