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

Commit 04c10d33 authored by liuchao's avatar liuchao Committed by Myles Watson
Browse files

Fix an inappropriate NULL-pointer check in handle_rc_passthrough_cmd

This fixes a potential NULL-pointer access in case p_remote_cmd is NULL

Test: mm -j 8
Change-Id: I06ae9afb9ae161296828e06b2c00d921189bee5c
parent 70556f32
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -732,20 +732,19 @@ void handle_rc_disconnect(tBTA_AV_RC_CLOSE* p_rc_close) {
 *
 ***************************************************************************/
void handle_rc_passthrough_cmd(tBTA_AV_REMOTE_CMD* p_remote_cmd) {
  if (p_remote_cmd == NULL) {
    BTIF_TRACE_ERROR("%s: No remote command!", __func__);
    return;
  }

  btif_rc_device_cb_t* p_dev =
      btif_rc_get_device_by_handle(p_remote_cmd->rc_handle);

  if (p_dev == NULL) {
    BTIF_TRACE_ERROR("%s: Got passthrough command from invalid rc handle",
                     __func__);
    return;
  }

  if (p_remote_cmd == NULL) {
    BTIF_TRACE_ERROR("%s: No remote command!", __func__);
    return;
  }

  bt_bdaddr_t rc_addr;
  bdcpy(rc_addr.address, p_dev->rc_addr);