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

Bluetooth: classic: avdtp: missing buffer length check #83024

Closed
lylezhu2012 opened this issue Dec 16, 2024 · 0 comments · Fixed by #83026
Closed

Bluetooth: classic: avdtp: missing buffer length check #83024

lylezhu2012 opened this issue Dec 16, 2024 · 0 comments · Fixed by #83026
Assignees
Labels
area: Bluetooth Classic Bluetooth Classic (BR/EDR) area: Bluetooth bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug

Comments

@lylezhu2012
Copy link
Contributor

Describe the bug
The remaining data length of net buffer needs to be checked before pulling data from it.

To Reproduce
The remaining data length of net buffer needs to be checked before the net_buf_pull_u8 be called.

Such as,

static void avdtp_open_handler(struct bt_avdtp *session,
			struct net_buf *buf, uint8_t msg_type, uint8_t tid)
{
	if (msg_type == BT_AVDTP_CMD) {
		int err = 0;
		struct bt_avdtp_sep *sep;
		struct net_buf *rsp_buf;
		uint8_t error_code = 0;
               
               // Need to check buffer length?
		sep = avdtp_get_sep(net_buf_pull_u8(buf) >> 2);

Expected behavior
The remaining data length of net buffer needs to be checked before pulling data from it.

Impact
Result of exploitation could lead to instability (i.e., crash) or denial of service attacks.

Logs and console output
N/A

Environment (please complete the following information):
N/A

Additional context
N/A

@lylezhu2012 lylezhu2012 added the bug The issue is a bug, or the PR is fixing a bug label Dec 16, 2024
@lylezhu2012 lylezhu2012 self-assigned this Dec 16, 2024
lylezhu2012 added a commit to nxp-upstream/zephyr that referenced this issue Dec 16, 2024
Check the remaining data length of net buffer before pulling data from
it.

Fixes zephyrproject-rtos#83024

Signed-off-by: Lyle Zhu <[email protected]>
@kartben kartben added the priority: medium Medium impact/importance bug label Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Bluetooth Classic Bluetooth Classic (BR/EDR) area: Bluetooth bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants