check for overflowing msg len when unpacking A

unclebadtouches catched this.

closes #141
This commit is contained in:
Miek Gieben 2014-10-22 21:08:34 +01:00
parent d8da4d2fa7
commit 467e368cc1
1 changed files with 1 additions and 1 deletions

2
msg.go
View File

@ -1005,7 +1005,7 @@ func unpackStructValue(val reflect.Value, msg []byte, off int) (off1 int, err er
if off == lenmsg {
break // dyn. update
}
if off+net.IPv4len > rdend {
if off+net.IPv4len > rdend || off+net.IPv4len > lenmsg {
return lenmsg, &Error{err: "overflow unpacking a"}
}
fv.Set(reflect.ValueOf(net.IPv4(msg[off], msg[off+1], msg[off+2], msg[off+3])))