summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2013-02-13 17:11:30 +0100
committerFelix Fietkau <nbd@openwrt.org>2013-02-13 17:11:32 +0100
commit4d326e16578fa2992f3bb6ab21775d4db03558d4 (patch)
treec42282c4fd7331a7bf7187015b44a21d77495574
parent859c08948968051330b5daddc07d62b40eca23a7 (diff)
downloadunitd-4d326e16578fa2992f3bb6ab21775d4db03558d4.tar
unitd-4d326e16578fa2992f3bb6ab21775d4db03558d4.zip
hotplug: add extra validation for commands
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
-rw-r--r--hotplug-rule.c6
1 files changed, 6 insertions, 0 deletions
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;