Diff between 5cc87d0ab019473f662a716a81317bf0ce69dc65 and 33d823d2ee03747478f99a9218a4f0f0095ede5f
Changed Files
| File | Additions | Deletions | Status |
| android/main.c | +7 | -0 | modified |
Full Patch
diff --git a/android/main.c b/android/main.c
index 36cc8aa..4367228 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);