Skip to content

Commit 322ec30

Browse files
JordanYatesnashif
authored andcommitted
bluetooth: host: hci_core: add missing NULL check
Add check that the command buffer claimed in `bt_le_create_conn_cancel` is not `NULL`. Fixes a fault caused by providing the `NULL` buffer to `bt_hci_cmd_state_set_init`. Signed-off-by: Jordan Yates <[email protected]>
1 parent 4d48909 commit 322ec30

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

subsys/bluetooth/host/hci_core.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -858,6 +858,9 @@ int bt_le_create_conn_cancel(void)
858858
struct bt_hci_cmd_state_set state;
859859

860860
buf = bt_hci_cmd_create(BT_HCI_OP_LE_CREATE_CONN_CANCEL, 0);
861+
if (!buf) {
862+
return -ENOBUFS;
863+
}
861864

862865
bt_hci_cmd_state_set_init(buf, &state, bt_dev.flags,
863866
BT_DEV_INITIATING, false);

0 commit comments

Comments
 (0)