diff options
author | noiz <noiz@users.noreply.github.com> | 2021-10-25 15:23:25 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-25 23:23:25 +0100 |
commit | b259fbf29d7641ef65cc26bee6ab982ab5a32858 (patch) | |
tree | 52a71503419a1c25a3b08267c9c0c486992dacce /dhcpv4 | |
parent | 63954f993bd3cc56f2999e34c67e75fb5be7ed0f (diff) |
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 <noiz@users.noreply.github.com>
Co-authored-by: Pablo Mazzini <pmazzini@gmail.com>
Diffstat (limited to 'dhcpv4')
-rw-r--r-- | dhcpv4/client4/client.go | 2 |
1 files changed, 1 insertions, 1 deletions
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 { |