nimble/iso: Fix missing BIG NULL pointer checks

The BIG lookup function returns NULL if BIG has not been found, thus to
be safe the return value has to be checked in case functions are called
with big_handle value of non-existent BIG.
This commit is contained in:
Mariusz Skamra
2024-02-27 09:43:43 +01:00
committed by Łukasz Rymanowski
parent 894a8f497a
commit faaa8e821a
+9
View File
@@ -29,6 +29,7 @@
#include "host/ble_iso.h"
#include "nimble/hci_common.h"
#include "sys/queue.h"
#include "ble_hs_priv.h"
#include "ble_hs_hci_priv.h"
struct ble_iso_big {
@@ -213,6 +214,10 @@ ble_iso_rx_create_big_complete(const struct ble_hci_ev_le_subev_create_big_compl
int i;
big = ble_iso_big_find_by_handle(ev->big_handle);
if (big == NULL) {
BLE_HS_LOG_ERROR("No BIG with handle=%d\n", ev->big_handle);
return;
}
big->num_bis = ev->num_bis;
@@ -250,6 +255,10 @@ ble_iso_rx_terminate_big_complete(const struct ble_hci_ev_le_subev_terminate_big
struct ble_iso_big *big;
big = ble_iso_big_find_by_handle(ev->big_handle);
if (big == NULL) {
BLE_HS_LOG_ERROR("No BIG with handle=%d\n", ev->big_handle);
return;
}
event.type = BLE_ISO_EVENT_BIG_TERMINATE_COMPLETE;
event.big_terminated.big_handle = ev->big_handle;