throw a MissingPayload error when unpacking packets with no frames

fixes #175
This commit is contained in:
Marten Seemann
2016-06-10 10:31:18 +07:00
parent 0d46cc1dd4
commit 581dc8a079
2 changed files with 15 additions and 5 deletions

View File

@@ -37,6 +37,10 @@ func (u *packetUnpacker) Unpack(publicHeaderBinary []byte, hdr *publicHeader, r
}
entropyBit := privateFlag&0x01 > 0
if r.Len() == 0 {
return nil, qerr.MissingPayload
}
fs := make([]frames.Frame, 0, 1)
// Read all frames in the packet