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

Commit abeb161e authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

Fix potential NULL dereference in smp_proc_confirm

Bug: 122102910
Test: compilation
Change-Id: Idd16e1c1924165924847f1aad64ddd44a8a1b8ab
parent ca93ad52
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -589,8 +589,6 @@ void smp_proc_pair_cmd(tSMP_CB* p_cb, tSMP_INT_DATA* p_data) {

/** process pairing confirm from peer device */
void smp_proc_confirm(tSMP_CB* p_cb, tSMP_INT_DATA* p_data) {
  uint8_t* p = p_data->p_data;

  SMP_TRACE_DEBUG("%s", __func__);

  if (smp_command_has_invalid_parameters(p_cb)) {
@@ -600,10 +598,13 @@ void smp_proc_confirm(tSMP_CB* p_cb, tSMP_INT_DATA* p_data) {
    return;
  }

  if (p_data) {
    uint8_t* p = p_data->p_data;
    if (p != NULL) {
      /* save the SConfirm for comparison later */
      STREAM_TO_ARRAY(p_cb->rconfirm.data(), p, OCTET16_LEN);
    }
  }

  p_cb->flags |= SMP_PAIR_FLAGS_CMD_CONFIRM;
}