validate lengths when parsing frames

ref #123
This commit is contained in:
Lucas Clemente
2016-05-27 23:07:29 +02:00
parent c546f5c9dc
commit 7c23ba7b07
4 changed files with 20 additions and 0 deletions

View File

@@ -62,6 +62,10 @@ func ParseStreamFrame(r *bytes.Reader) (*StreamFrame, error) {
}
}
if dataLen > uint16(protocol.MaxPacketSize) {
return nil, qerr.Error(qerr.InvalidStreamData, "data len too large")
}
if dataLen == 0 {
// The rest of the packet is data
frame.Data, err = ioutil.ReadAll(r)