Skip to content

Commit 141da30

Browse files
bluetooth: shell: pairing_accept callback access NULL pointer
pairing_accept callback is called with feat as NULL in the bt_hci_io_capa_req. Signed-off-by: Mark Wang <[email protected]>
1 parent b6cfb45 commit 141da30

File tree

1 file changed

+10
-6
lines changed
  • subsys/bluetooth/host/shell

1 file changed

+10
-6
lines changed

subsys/bluetooth/host/shell/bt.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4224,12 +4224,16 @@ static void auth_pincode_entry(struct bt_conn *conn, bool highsec)
42244224
enum bt_security_err pairing_accept(struct bt_conn *conn,
42254225
const struct bt_conn_pairing_feat *const feat)
42264226
{
4227-
bt_shell_print("Remote pairing features: "
4228-
"IO: 0x%02x, OOB: %d, AUTH: 0x%02x, Key: %d, "
4229-
"Init Kdist: 0x%02x, Resp Kdist: 0x%02x",
4230-
feat->io_capability, feat->oob_data_flag,
4231-
feat->auth_req, feat->max_enc_key_size,
4232-
feat->init_key_dist, feat->resp_key_dist);
4227+
if (feat != NULL) {
4228+
bt_shell_print("Remote pairing features: "
4229+
"IO: 0x%02x, OOB: %d, AUTH: 0x%02x, Key: %d, "
4230+
"Init Kdist: 0x%02x, Resp Kdist: 0x%02x",
4231+
feat->io_capability, feat->oob_data_flag,
4232+
feat->auth_req, feat->max_enc_key_size,
4233+
feat->init_key_dist, feat->resp_key_dist);
4234+
} else {
4235+
bt_shell_print("Remote pairing");
4236+
}
42334237

42344238
return BT_SECURITY_ERR_SUCCESS;
42354239
}

0 commit comments

Comments
 (0)