Skip to content

Commit fad6e22

Browse files
committed
nimble/ll: Validate channel map in LL_CHANNEL_MAP_IND
Check if received LL_CHANNEL_MAP_IND contains valid channel map. If map is invalid (less than 2 channels used) we terminate link with proper reason.
1 parent 8b6f3e8 commit fad6e22

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

nimble/controller/src/ble_ll_ctrl.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2483,6 +2483,17 @@ ble_ll_ctrl_rx_chanmap_req(struct ble_ll_conn_sm *connsm, uint8_t *dptr)
24832483
}
24842484
#endif
24852485

2486+
/* Minimum number of channels is 2.
2487+
* If invalid map was provided we have to end the connection.
2488+
*/
2489+
if (ble_ll_utils_chan_map_used_get(dptr) < 2) {
2490+
ble_ll_conn_timeout(connsm, BLE_ERR_INV_LMP_LL_PARM);
2491+
return BLE_ERR_MAX;
2492+
}
2493+
2494+
/* The bits in positions 37, 38 and 39 are reserved for future use */
2495+
dptr[4] &= 0x1f;
2496+
24862497
/* If instant is in the past, we have to end the connection */
24872498
instant = get_le16(dptr + BLE_LL_CHAN_MAP_LEN);
24882499
conn_events = (instant - connsm->event_cntr) & 0xFFFF;

0 commit comments

Comments
 (0)