android: Shutdown if IPC command for unregistered service is received

Sending commands to not registered services is violation of IPC spec
and should result in daemon shutdown.
This commit is contained in:
Szymon Janc 2013-11-13 15:47:12 +01:00 committed by Johan Hedberg
parent 5cc87d0ab0
commit 33d823d2ee

View File

@ -252,6 +252,13 @@ static gboolean cmd_watch_cb(GIOChannel *io, GIOCondition cond,
DBG("service_id %u opcode %u len %u", msg->service_id, msg->opcode,
msg->len);
if (msg->service_id > HAL_SERVICE_ID_MAX ||
!services[msg->service_id]) {
error("HAL command for unregistered service %u, terminating",
msg->service_id);
goto fail;
}
switch (msg->service_id) {
case HAL_SERVICE_ID_CORE:
handle_service_core(msg->opcode, msg->payload, msg->len);