Stop parsing when hitting rdlen
Stop parsing these records when we hit rdlen.
This commit is contained in:
parent
11bbb59419
commit
34f43d398b
10
msg.go
10
msg.go
|
@ -1016,24 +1016,24 @@ func unpackStructValue(val reflect.Value, msg []byte, off int) (off1 int, err er
|
||||||
// do nothing?
|
// do nothing?
|
||||||
off = off1 + int(optlen)
|
off = off1 + int(optlen)
|
||||||
}
|
}
|
||||||
if off < rdend {
|
if off < lenrd {
|
||||||
goto Option
|
goto Option
|
||||||
}
|
}
|
||||||
fv.Set(reflect.ValueOf(edns))
|
fv.Set(reflect.ValueOf(edns))
|
||||||
case `dns:"a"`:
|
case `dns:"a"`:
|
||||||
if off == lenmsg {
|
if off == lenrd {
|
||||||
break // dyn. update
|
break // dyn. update
|
||||||
}
|
}
|
||||||
if off+net.IPv4len > rdend || off+net.IPv4len > lenmsg {
|
if off+net.IPv4len > lenrd || off+net.IPv4len > lenmsg {
|
||||||
return lenmsg, &Error{err: "overflow unpacking a"}
|
return lenmsg, &Error{err: "overflow unpacking a"}
|
||||||
}
|
}
|
||||||
fv.Set(reflect.ValueOf(net.IPv4(msg[off], msg[off+1], msg[off+2], msg[off+3])))
|
fv.Set(reflect.ValueOf(net.IPv4(msg[off], msg[off+1], msg[off+2], msg[off+3])))
|
||||||
off += net.IPv4len
|
off += net.IPv4len
|
||||||
case `dns:"aaaa"`:
|
case `dns:"aaaa"`:
|
||||||
if off == rdend {
|
if off == lenrd {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if off+net.IPv6len > rdend || off+net.IPv6len > lenmsg {
|
if off+net.IPv6len > lenrd || off+net.IPv6len > lenmsg {
|
||||||
return lenmsg, &Error{err: "overflow unpacking aaaa"}
|
return lenmsg, &Error{err: "overflow unpacking aaaa"}
|
||||||
}
|
}
|
||||||
fv.Set(reflect.ValueOf(net.IP{msg[off], msg[off+1], msg[off+2], msg[off+3], msg[off+4],
|
fv.Set(reflect.ValueOf(net.IP{msg[off], msg[off+1], msg[off+2], msg[off+3], msg[off+4],
|
||||||
|
|
Loading…
Reference in New Issue