Skip to content

Commit

Permalink
Bluetooth: A2DP: Check the pointer before using
Browse files Browse the repository at this point in the history
Check the pointer `sep` before using it.

Fixes #74734.

Signed-off-by: Lyle Zhu <[email protected]>
  • Loading branch information
lylezhu2012 committed Jul 3, 2024
1 parent 012520d commit bc88ff5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions subsys/bluetooth/host/classic/a2dp.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,14 @@ static int a2dp_set_config_ind(struct bt_avdtp *session, struct bt_avdtp_sep *se
int err;

*errcode = 0;
ep = CONTAINER_OF(sep, struct bt_a2dp_ep, sep);
if (ep == NULL) {

if (sep == NULL) {
*errcode = BT_AVDTP_BAD_ACP_SEID;
return -1;
}

ep = CONTAINER_OF(sep, struct bt_a2dp_ep, sep);

/* parse the configuration */
codec_info_element_len = 4U;
err = bt_avdtp_parse_capability_codec(buf,
Expand Down

0 comments on commit bc88ff5

Please sign in to comment.