Skip to content

Commit

Permalink
Add length check before reading label pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
jtt committed Feb 9, 2022
1 parent 5e0e439 commit d2979cf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions dnsutils/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,9 @@ func _ParseLabels(offset int, payload []byte, pointers map[uint16]int) (string,
}
// label pointer support ?
if length>>6 == 3 {
if offset+1 >= len(payload) {
return "", 0, ErrDecodeDnsLabelTooShort
}
ptr := binary.BigEndian.Uint16(payload[offset:offset+2]) & 16383
_, exist := pointers[ptr]
if exist {
Expand Down

0 comments on commit d2979cf

Please sign in to comment.