diff --git a/system/btif/src/btif_rc.cc b/system/btif/src/btif_rc.cc index 15318649e09f30a0cd3dd74a5d23ac5b76130e0b..dae4b5c716b29974bd8b301d2cc7c38a17af95e5 100644 --- a/system/btif/src/btif_rc.cc +++ b/system/btif/src/btif_rc.cc @@ -1959,6 +1959,11 @@ static bt_status_t register_notification_rsp( dump_rc_notification_event_id(event_id)); std::unique_lock<std::mutex> lock(btif_rc_cb.lock); + if (event_id > MAX_RC_NOTIFICATIONS) { + BTIF_TRACE_ERROR("Invalid event id"); + return BT_STATUS_PARM_INVALID; + } + memset(&(avrc_rsp.reg_notif), 0, sizeof(tAVRC_REG_NOTIF_RSP)); avrc_rsp.reg_notif.event_id = event_id;