Check nsec unpacking
This commit is contained in:
parent
84700f043f
commit
1ae8cb4101
15
msg.go
15
msg.go
|
@ -642,14 +642,15 @@ func unpackStructValue(val reflect.Value, msg []byte, off int) (off1 int, ok boo
|
||||||
seen := 2
|
seen := 2
|
||||||
for seen < rdlength {
|
for seen < rdlength {
|
||||||
window = int(msg[off])
|
window = int(msg[off])
|
||||||
|
//println("off", off, "lenmsg", lenmsg)
|
||||||
length = int(msg[off+1])
|
length = int(msg[off+1])
|
||||||
if length == 0 {
|
if length == 0 {
|
||||||
// Last one
|
// Last one
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if length > 32 {
|
if length > 32 {
|
||||||
//println("dns: overflow unpacking NSEC")
|
//println("dns: overflow unpacking NSEC")
|
||||||
// Funny, this happens, but isn't an error. TODO(mg)
|
// Funny, this happens, but isn't an error. TODO(mg)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -684,6 +685,10 @@ func unpackStructValue(val reflect.Value, msg []byte, off int) (off1 int, ok boo
|
||||||
}
|
}
|
||||||
off += length
|
off += length
|
||||||
seen += length + 2
|
seen += length + 2
|
||||||
|
if off+1 > lenmsg {
|
||||||
|
println("dns: overflow unpacking NSEC")
|
||||||
|
return lenmsg, false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fv.Set(reflect.ValueOf(nsec))
|
fv.Set(reflect.ValueOf(nsec))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue