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 <lyle.zhu@nxp.com>
@kartben kartben added the priority: medium Medium impact/importance bug label Dec 17, 2024
coreboot-org-bot pushed a commit to coreboot/zephyr-cros that referenced this issue Dec 20, 2024
Check the remaining data length of net buffer before pulling data from
it.

Fixes zephyrproject-rtos/zephyr#83024

(cherry picked from commit 830c1f8)

Original-Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
GitOrigin-RevId: 830c1f8
Cr-Build-Id: 8728219973957200769
Cr-Build-Url: https://cr-buildbucket.appspot.com/build/8728219973957200769
Copybot-Job-Name: zephyr-main-copybot-downstream
Change-Id: I7f45c0bc084722cc2f71a06363567874e2de27c8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/6104909
Commit-Queue: Jonathon Murphy <jpmurphy@google.com>
Reviewed-by: Dawid Niedźwiecki <dawidn@google.com>
Tested-by: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com>
Tested-by: Dawid Niedźwiecki <dawidn@google.com>
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