Skip to content

Commit 790bd7c

Browse files
JordanYatesdkalowsk
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 c2ad663 commit 790bd7c

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
@@ -891,6 +891,9 @@ int bt_le_create_conn_cancel(void)
891891
struct bt_hci_cmd_state_set state;
892892

893893
buf = bt_hci_cmd_create(BT_HCI_OP_LE_CREATE_CONN_CANCEL, 0);
894+
if (!buf) {
895+
return -ENOBUFS;
896+
}
894897

895898
bt_hci_cmd_state_set_init(buf, &state, bt_dev.flags,
896899
BT_DEV_INITIATING, false);

0 commit comments

Comments
 (0)