update to latest adns with fix for endless loop for incoming corrupt packets

This commit is contained in:
Mechiel Lukkien
2024-05-09 11:30:42 +02:00
parent 09ee89d5c8
commit 98ce133203
4 changed files with 10 additions and 6 deletions

View File

@ -262,7 +262,9 @@ func checkHeader(p *dnsmessage.Parser, h dnsmessage.Header) error {
return errServerTemporarilyMisbehaving
}
if rh.Type != dnsmessage.TypeOPT {
p.SkipAdditional()
if err := p.SkipAdditional(); err != nil {
return errInvalidDNSResponse
}
continue
}
// Only one OPT record is allowed. With multiple we MUST return an error. See RFC
@ -328,7 +330,9 @@ func extractExtendedRCode(p dnsmessage.Parser, hdr dnsmessage.Header) (dnsmessag
if ahdr.Type == dnsmessage.TypeOPT {
return ahdr.ExtendedRCode(hdr.RCode), hasAdd
}
p.SkipAdditional()
if err := p.SkipAdditional(); err != nil {
return hdr.RCode, hasAdd
}
}
}