Skip to content

Commit 8113ff7

Browse files
lylezhu2012nashif
authored andcommitted
bluetooth: AVDTP: Check buffer len before pulling data
Check the remaining buffer length is not less than required data length before pulling data from the buffer. Signed-off-by: Lyle Zhu <[email protected]>
1 parent b97300e commit 8113ff7

File tree

1 file changed

+5
-0
lines changed
  • subsys/bluetooth/host/classic

1 file changed

+5
-0
lines changed

subsys/bluetooth/host/classic/avdtp.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -919,6 +919,11 @@ int bt_avdtp_l2cap_recv(struct bt_l2cap_chan *chan, struct net_buf *buf)
919919
struct net_buf *rsp_buf;
920920
int err;
921921

922+
if (buf->len < sizeof(sigid)) {
923+
LOG_ERR("Invalid AVDTP Header");
924+
return 0;
925+
}
926+
922927
sigid = net_buf_pull_u8(buf);
923928
rsp_buf = avdtp_create_reply_pdu(BT_AVDTP_REJECT,
924929
BT_AVDTP_PACKET_TYPE_SINGLE,

0 commit comments

Comments
 (0)