Skip to content

Commit bf4e3fe

Browse files
hermabecarlescufi
authored andcommitted
Bluetooth: Host: Fix sync subevent cmd length
The subevents were not considered in the length of the command. Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
1 parent 0d8292a commit bf4e3fe

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

subsys/bluetooth/host/scan.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1092,7 +1092,12 @@ int bt_le_per_adv_sync_subevent(struct bt_le_per_adv_sync *per_adv_sync,
10921092
struct bt_hci_cp_le_set_pawr_sync_subevent *cp;
10931093
struct net_buf *buf;
10941094

1095-
buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_PER_ADV_SYNC_SUBEVENT, sizeof(*cp));
1095+
if (params->num_subevents > BT_HCI_PAWR_SUBEVENT_MAX) {
1096+
return -EINVAL;
1097+
}
1098+
1099+
buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_PER_ADV_SYNC_SUBEVENT,
1100+
sizeof(*cp) + params->num_subevents);
10961101

10971102
if (!buf) {
10981103
return -ENOBUFS;

0 commit comments

Comments
 (0)