Skip to content

Commit

Permalink
Bluetooth: CAP: Add size and rank checks for CAS register
Browse files Browse the repository at this point in the history
For the CAP acceptor the size and rank characteristic shall
be set as per the CAP spec. Add checks for 0, as 0 indicates
not initializing the characteristics in the CSIS instance.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
  • Loading branch information
Thalley committed Oct 10, 2023
1 parent e7bd10a commit 25c6a54
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions subsys/bluetooth/audio/cap_acceptor.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ int bt_cap_acceptor_register(const struct bt_csip_set_member_register_param *par
static struct bt_gatt_service cas;
int err;

CHECKIF(param->set_size == 0U) {
LOG_DBG("param->set_size shall be non-zero");
return -EINVAL;
}

CHECKIF(param->rank == 0U) {
LOG_DBG("param->rank shall be non-zero");
return -EINVAL;
}

err = bt_csip_set_member_register(param, svc_inst);
if (err != 0) {
LOG_DBG("Failed to register CSIP");
Expand Down

0 comments on commit 25c6a54

Please sign in to comment.