From 4d326e16578fa2992f3bb6ab21775d4db03558d4 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 13 Feb 2013 17:11:30 +0100 Subject: [PATCH] hotplug: add extra validation for commands Signed-off-by: Felix Fietkau --- hotplug-rule.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hotplug-rule.c b/hotplug-rule.c index 7e9c16a..b157fcd 100644 --- a/hotplug-rule.c +++ b/hotplug-rule.c @@ -399,6 +399,12 @@ static int __rule_process_cmd(struct blob_attr *cur, struct blob_attr *msg) bool found; int ret; + if (blobmsg_type(cur) != BLOBMSG_TYPE_ARRAY || + blobmsg_type(blobmsg_data(cur)) != BLOBMSG_TYPE_STRING) { + rule_error(cur, "Unexpected element type"); + return -1; + } + ret = __rule_process_type(cur, msg, cmd, ARRAY_SIZE(cmd), &found); if (found) return ret; -- 2.25.1