From 33d823d2ee03747478f99a9218a4f0f0095ede5f Mon Sep 17 00:00:00 2001 From: Szymon Janc Date: Wed, 13 Nov 2013 15:47:12 +0100 Subject: [PATCH] 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. --- android/main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/android/main.c b/android/main.c index 36cc8aaaf..436722855 100644 --- a/android/main.c +++ b/android/main.c @@ -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); -- 2.47.3