udhcpd: fix hostname truncation bug 1663
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
0a2c793bd6
commit
fde3fb3009
@ -60,6 +60,8 @@ struct dyn_lease* FAST_FUNC add_lease(
|
||||
memset(oldest, 0, sizeof(*oldest));
|
||||
if (hostname) {
|
||||
char *p;
|
||||
|
||||
hostname_len++; /* include NUL */
|
||||
if (hostname_len > sizeof(oldest->hostname))
|
||||
hostname_len = sizeof(oldest->hostname);
|
||||
p = safe_strncpy(oldest->hostname, hostname, hostname_len);
|
||||
|
Loading…
Reference in New Issue
Block a user