packet.writeTo now defends against a zero pkt.bodySize.

This commit is contained in:
scruzin 2019-01-13 14:28:24 +10:30
parent 9f3d49faa5
commit 4c6c549f98
1 changed files with 1 additions and 1 deletions

View File

@ -272,7 +272,7 @@ func (pkt *packet) resize(size uint32, ht uint8) {
// We defer sending small audio packets and combine consecutive small audio packets where possible to reduce I/O.
// When queue is true, we expect a response to this request and cache the method on s.methodCalls.
func (pkt *packet) writeTo(s *Session, queue bool) error {
if pkt.body == nil {
if pkt.body == nil || pkt.bodySize == 0 {
return errInvalidBody
}