From 0263cd7bbc18c3223d1d048c3dd1cb49b0c32797 Mon Sep 17 00:00:00 2001 From: Petr Rockai Date: Wed, 2 Mar 2011 14:20:48 +0000 Subject: [PATCH] Do not run past the end of an array in dmeventd's _handle_request when faced with an unknown command ID. --- daemons/dmeventd/dmeventd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c index 28e492eff..b30c20471 100644 --- a/daemons/dmeventd/dmeventd.c +++ b/daemons/dmeventd/dmeventd.c @@ -1388,7 +1388,7 @@ static int _client_write(struct dm_event_fifos *fifos, static int _handle_request(struct dm_event_daemon_message *msg, struct message_data *message_data) { - static struct { + static struct request { unsigned int cmd; int (*f)(struct message_data *); } requests[] = { @@ -1403,7 +1403,7 @@ static int _handle_request(struct dm_event_daemon_message *msg, { DM_EVENT_CMD_GET_STATUS, _get_status}, }, *req; - for (req = requests; req < requests + sizeof(requests); req++) + for (req = requests; req < requests + sizeof(requests) / sizeof(struct request); req++) if (req->cmd == msg->cmd) return req->f(message_data); -- 2.43.5