Check for the end of the message

This commit is contained in:
Miek Gieben 2013-09-22 19:35:10 +01:00
parent 007c0f06e4
commit 4e6b3a5afc
1 changed files with 5 additions and 0 deletions

5
msg.go
View File

@ -471,6 +471,11 @@ func packStructValue(val reflect.Value, msg []byte, off int, compression map[str
// Length
msg[off+2], msg[off+3] = packUint16(uint16(len(b)))
off += 4
if off+len(b) > lenmsg {
copy(msg[off:], b)
off = lenmsg
continue
}
// Actual data
copy(msg[off:off+len(b)], b)
off += len(b)