From b259fbf29d7641ef65cc26bee6ab982ab5a32858 Mon Sep 17 00:00:00 2001 From: noiz Date: Mon, 25 Oct 2021 15:23:25 -0700 Subject: Fix buffer end location (#447) Fix payload buffer to end at actual payload end. UDP header length includes the 8 bytes of the header so we do not want the +8 at the end of the buffer. Signed-off-by: noiz Co-authored-by: Pablo Mazzini --- dhcpv4/client4/client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'dhcpv4/client4/client.go') diff --git a/dhcpv4/client4/client.go b/dhcpv4/client4/client.go index 5dab176..f274714 100644 --- a/dhcpv4/client4/client.go +++ b/dhcpv4/client4/client.go @@ -322,7 +322,7 @@ func (c *Client) SendReceive(sendFd, recvFd int, packet *dhcpv4.DHCPv4, messageT } // UDP checksum is not checked pLen := int(binary.BigEndian.Uint16(udph[4:6])) - payload := buf[iph.Len+8 : iph.Len+8+pLen] + payload := buf[iph.Len+8 : iph.Len+pLen] response, innerErr = dhcpv4.FromBytes(payload) if innerErr != nil { -- cgit v1.2.3