diff options
-rw-r--r-- | dhcpv4/nclient4/conn_unix.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/dhcpv4/nclient4/conn_unix.go b/dhcpv4/nclient4/conn_unix.go index 7f79f50..67ac94c 100644 --- a/dhcpv4/nclient4/conn_unix.go +++ b/dhcpv4/nclient4/conn_unix.go @@ -105,14 +105,15 @@ func (upc *BroadcastRawUDPConn) ReadFrom(b []byte) (int, net.Addr, error) { } ipHdr := ipv4(buf.Data()) + headerLength := ipHdr.headerLength() - if !buf.Has(int(ipHdr.headerLength())) { + if !buf.Has(int(headerLength)) { continue } - ipHdr = ipv4(buf.Consume(int(ipHdr.headerLength()))) + ipHdr = ipv4(buf.Consume(int(headerLength))) - if ipHdr.transportProtocol() != udpProtocolNumber { + if headerLength <= protocol || ipHdr.transportProtocol() != udpProtocolNumber { continue } |