Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport v2.4-branch] Bluetooth: L2CAP: Fix missing buffer length check for sdu_len #33514

Merged
merged 1 commit into from Mar 23, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions subsys/bluetooth/host/l2cap.c
Expand Up @@ -2185,6 +2185,12 @@ static void l2cap_chan_le_recv(struct bt_l2cap_le_chan *chan,
return;
}

if (buf->len < 2) {
BT_WARN("Too short data packet");
bt_l2cap_chan_disconnect(&chan->chan);
return;
}

sdu_len = net_buf_pull_le16(buf);

BT_DBG("chan %p len %u sdu_len %u", chan, buf->len, sdu_len);
Expand Down