Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1cf21acb authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

Fix crash in smp_br_state_machine_event

p_cb->role value should be checked before it's used

Test: compilation
Bug: 162327732
Change-Id: I5f4ed835621a0a94fa04d41febad02b8f1c11b89
parent bff3c2fe
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -303,7 +303,6 @@ void smp_br_state_machine_event(tSMP_CB* p_cb, tSMP_BR_EVENT event,
  tSMP_BR_STATE curr_state = p_cb->br_state;
  tSMP_BR_SM_TBL state_table;
  uint8_t action, entry;
  tSMP_BR_ENTRY_TBL entry_table = smp_br_entry_table[p_cb->role];

  SMP_TRACE_EVENT("main %s", __func__);
  if (curr_state >= SMP_BR_STATE_MAX) {
@@ -317,6 +316,8 @@ void smp_br_state_machine_event(tSMP_CB* p_cb, tSMP_BR_EVENT event,
    return;
  }

  tSMP_BR_ENTRY_TBL entry_table = smp_br_entry_table[p_cb->role];

  SMP_TRACE_DEBUG("SMP Role: %s State: [%s (%d)], Event: [%s (%d)]",
                  (p_cb->role == HCI_ROLE_SLAVE) ? "Slave" : "Master",
                  smp_get_br_state_name(p_cb->br_state), p_cb->br_state,