summaryrefslogtreecommitdiffhomepage
path: root/dhcpv4/nclient4/conn_unix.go
diff options
context:
space:
mode:
authorPablo Mazzini <pmazzini@gmail.com>2023-07-31 15:04:34 +0100
committerGitHub <noreply@github.com>2023-07-31 15:04:34 +0100
commit0f9eb93a696c6d0a39ea3d7d0908b7dc1241b603 (patch)
tree68c7fc3019ba996f20414570f2bbef0339ecce3f /dhcpv4/nclient4/conn_unix.go
parent5648422c16cd75ffbe2c0c792a11badae15ab5e9 (diff)
parent5771e168857a17094174b2c31c44fe7779ca0b75 (diff)
Merge pull request #507 from Boneyan/fix-out-of-bounds-read
Fix out of bounds read
Diffstat (limited to 'dhcpv4/nclient4/conn_unix.go')
-rw-r--r--dhcpv4/nclient4/conn_unix.go7
1 files changed, 1 insertions, 6 deletions
diff --git a/dhcpv4/nclient4/conn_unix.go b/dhcpv4/nclient4/conn_unix.go
index 7f79f50..1495dc2 100644
--- a/dhcpv4/nclient4/conn_unix.go
+++ b/dhcpv4/nclient4/conn_unix.go
@@ -99,14 +99,9 @@ func (upc *BroadcastRawUDPConn) ReadFrom(b []byte) (int, net.Addr, error) {
pkt = pkt[:n]
buf := uio.NewBigEndianBuffer(pkt)
- // To read the header length, access data directly.
- if !buf.Has(ipv4MinimumSize) {
- continue
- }
-
ipHdr := ipv4(buf.Data())
- if !buf.Has(int(ipHdr.headerLength())) {
+ if !ipHdr.isValid(n) {
continue
}