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

Commit eb44f625 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Check ch_id in UIPC_Read before using it"

parents c36da0d3 8b0caf0d
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -621,15 +621,15 @@ bool UIPC_Send(tUIPC_STATE& uipc, tUIPC_CH_ID ch_id,
uint32_t UIPC_Read(tUIPC_STATE& uipc, tUIPC_CH_ID ch_id,
                   UNUSED_ATTR uint16_t* p_msg_evt, uint8_t* p_buf,
                   uint32_t len) {
  int n_read = 0;
  int fd = uipc.ch[ch_id].fd;
  struct pollfd pfd;

  if (ch_id >= UIPC_CH_NUM) {
    BTIF_TRACE_ERROR("UIPC_Read : invalid ch id %d", ch_id);
    return 0;
  }

  int n_read = 0;
  int fd = uipc.ch[ch_id].fd;
  struct pollfd pfd;

  if (fd == UIPC_DISCONNECTED) {
    BTIF_TRACE_ERROR("UIPC_Read : channel %d closed", ch_id);
    return 0;