Skip to content

Commit

Permalink
nimble/audio/bass: Add data length check in BASS remote scan
Browse files Browse the repository at this point in the history
This commit adds data length checks to remote scan operations.
Now any data coming with remote scan start/stop will result
in instant ATT error.
  • Loading branch information
szymon-czapracki committed Aug 22, 2024
1 parent f8994e1 commit cc96530
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions nimble/host/audio/services/bass/src/ble_audio_svc_bass.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,10 @@ ble_svc_audio_bass_receive_state_free(struct ble_svc_audio_bass_rcv_state_entry
static int
ble_svc_audio_bass_remote_scan_stopped(uint8_t *data, uint16_t data_len, uint16_t conn_handle)
{
if (data_len > 1) {
return BLE_ATT_ERR_WRITE_REJECTED;
}

struct ble_audio_event ev = {
.type = BLE_AUDIO_EVENT_BASS_REMOTE_SCAN_STOPPED
};
Expand All @@ -264,6 +268,10 @@ ble_svc_audio_bass_remote_scan_stopped(uint8_t *data, uint16_t data_len, uint16_
static int
ble_svc_audio_bass_remote_scan_started(uint8_t *data, uint16_t data_len, uint16_t conn_handle)
{
if (data_len > 1) {
return BLE_ATT_ERR_WRITE_REJECTED;
}

struct ble_audio_event ev = {
.type = BLE_AUDIO_EVENT_BASS_REMOTE_SCAN_STARTED
};
Expand Down

0 comments on commit cc96530

Please sign in to comment.