Bluetooth: L2CAP: Fix segmentation

The segments need to be limited by the minimun of the segment buffer
tailroom and tx MPS not the original buf length.

Change-Id: I580a3bb61aa190ac0cdd3717bc06fd6e6e668304
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
Luiz Augusto von Dentz 2016-11-18 15:53:43 +02:00 committed by Johan Hedberg
commit 37b0e0ab2e

View file

@ -1593,7 +1593,7 @@ segment:
}
/* Don't send more that TX MPS including SDU length */
len = min(buf->len, ch->tx.mps - sdu_hdr_len);
len = min(net_buf_tailroom(seg), ch->tx.mps - sdu_hdr_len);
memcpy(net_buf_add(seg, len), buf->data, len);
net_buf_pull(buf, len);