mirror of
https://github.com/nadoo/glider.git
synced 2025-02-23 09:25:41 +08:00
dns: return error when there's not enough length for rdata. #55
This commit is contained in:
parent
981d226bd1
commit
1b4489cd67
@ -381,6 +381,11 @@ func (m *Message) UnmarshalRR(start int, rr *RR) (n int, err error) {
|
||||
rr.CLASS = binary.BigEndian.Uint16(p[n+2:])
|
||||
rr.TTL = binary.BigEndian.Uint32(p[n+4:])
|
||||
rr.RDLENGTH = binary.BigEndian.Uint16(p[n+8:])
|
||||
|
||||
if len(p) <= n+10+int(rr.RDLENGTH) {
|
||||
return 0, errors.New("UnmarshalRR: not enough data for RDATA")
|
||||
}
|
||||
|
||||
rr.RDATA = p[n+10 : n+10+int(rr.RDLENGTH)]
|
||||
|
||||
if rr.TYPE == QTypeA {
|
||||
|
Loading…
Reference in New Issue
Block a user