diff options
author | noiz <noiz@users.noreply.github.com> | 2021-10-25 10:58:54 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-25 18:58:54 +0100 |
commit | 0c623abe15f981f59d47fc27ecca98951da40a76 (patch) | |
tree | f852aabef11bc07aef27acd7abb1b1d7f16a81e5 /dhcpv4 | |
parent | 509557e9f7816c12f5f7ed4e674f542480ab4c07 (diff) |
Fix nil check to prevent a panic by trying to dereference a nil pointer (#451)
Signed-off-by: noiz <noiz@users.noreply.github.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 5c5c18d..5dab176 100644 --- a/dhcpv4/client4/client.go +++ b/dhcpv4/client4/client.go @@ -314,7 +314,7 @@ func (c *Client) SendReceive(sendFd, recvFd int, packet *dhcpv4.DHCPv4, messageT } dstPort := int(binary.BigEndian.Uint16(udph[2:4])) expectedDstPort := dhcpv4.ClientPort - if c.RemoteAddr != nil { + if c.LocalAddr != nil { expectedDstPort = c.LocalAddr.(*net.UDPAddr).Port } if dstPort != expectedDstPort { |