diff options
-rw-r--r-- | networking/udhcp/leases.c | 3 |
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); |