[PATCH 1/2] android: Shutdown if IPC command for unregistered service is received

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sending commands to not registered services is violation of IPC spec
and should result in daemon shutdown.
---
 android/main.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/android/main.c b/android/main.c
index 36cc8aa..12284f7 100644
--- a/android/main.c
+++ b/android/main.c
@@ -252,6 +252,12 @@ 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 of not registered service, terminating");
+		goto fail;
+	}
+
 	switch (msg->service_id) {
 	case HAL_SERVICE_ID_CORE:
 		handle_service_core(msg->opcode, msg->payload, msg->len);
-- 
1.8.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux