summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/miekg/dns/msg.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/miekg/dns/msg.go')
-rw-r--r--vendor/github.com/miekg/dns/msg.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/vendor/github.com/miekg/dns/msg.go b/vendor/github.com/miekg/dns/msg.go
index 7001f6da79..1728a98b7d 100644
--- a/vendor/github.com/miekg/dns/msg.go
+++ b/vendor/github.com/miekg/dns/msg.go
@@ -624,11 +624,18 @@ func UnpackRRWithHeader(h RR_Header, msg []byte, off int) (rr RR, off1 int, err
rr = &RFC3597{Hdr: h}
}
- if noRdata(h) {
- return rr, off, nil
+ if off < 0 || off > len(msg) {
+ return &h, off, &Error{err: "bad off"}
}
end := off + int(h.Rdlength)
+ if end < off || end > len(msg) {
+ return &h, end, &Error{err: "bad rdlength"}
+ }
+
+ if noRdata(h) {
+ return rr, off, nil
+ }
off, err = rr.unpack(msg, off)
if err != nil {