Skip to content

Commit 7365bcf

Browse files
JordanYateskartben
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 bf3aa73 commit 7365bcf

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
@@ -884,6 +884,9 @@ int bt_le_create_conn_cancel(void)
884884
struct bt_hci_cmd_state_set state;
885885

886886
buf = bt_hci_cmd_create(BT_HCI_OP_LE_CREATE_CONN_CANCEL, 0);
887+
if (!buf) {
888+
return -ENOBUFS;
889+
}
887890

888891
bt_hci_cmd_state_set_init(buf, &state, bt_dev.flags,
889892
BT_DEV_INITIATING, false);

0 commit comments

Comments
 (0)