diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2021-08-11 17:04:54 +0200 |
---|---|---|
committer | Hans Dedecker <dedeckeh@gmail.com> | 2021-08-15 17:34:55 +0200 |
commit | 01b4e6046f10e21809c3f380f2d33bf3fe59698d (patch) | |
tree | aceca8a92a9e6701ccb295ecc0451160db3c404a /src/dhcpv4.c | |
parent | 16667699228101fda936068e3d11c0cf19270e34 (diff) |
The hostname buffer is uninitialized if the client doesn't provide
DHCPV4_OPT_HOSTNAME. Use hostname from the assignment which is present if
a static lease contains the hostname or if the client provides one, and
the hostname is valid. It's also used in the ubus ipv4leases method.
Signed-off-by: Mikael Magnusson <mikma@users.sourceforge.net>
Diffstat (limited to 'src/dhcpv4.c')
-rw-r--r-- | src/dhcpv4.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/dhcpv4.c b/src/dhcpv4.c index c3d16f5..a3b0e33 100644 --- a/src/dhcpv4.c +++ b/src/dhcpv4.c @@ -758,7 +758,7 @@ void dhcpv4_handle_msg(void *addr, void *data, size_t len, #ifdef WITH_UBUS if (reqmsg == DHCPV4_MSG_RELEASE) ubus_bcast_dhcp_event("dhcp.release", req->chaddr, req->hlen, - &req->ciaddr, hostname, iface->ifname); + &req->ciaddr, a ? a->hostname : NULL, iface->ifname); #endif if (reqmsg == DHCPV4_MSG_DECLINE || reqmsg == DHCPV4_MSG_RELEASE) return; @@ -915,7 +915,7 @@ void dhcpv4_handle_msg(void *addr, void *data, size_t len, #ifdef WITH_UBUS if (msg == DHCPV4_MSG_ACK) ubus_bcast_dhcp_event("dhcp.ack", req->chaddr, req->hlen, &reply.yiaddr, - hostname, iface->ifname); + a ? a->hostname : NULL, iface->ifname); #endif } |