summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2013-02-12 17:25:56 +0100
committerFelix Fietkau <nbd@openwrt.org>2013-02-12 17:25:56 +0100
commit144991354372ae010c84ec7d9efecb03ad3fae74 (patch)
treeb07db9101849a07014bfa11bc8b86087e2e99eee
parent0e1ddb8cc10fab53958d5a73329efefaa49b7b12 (diff)
downloadunitd-144991354372ae010c84ec7d9efecb03ad3fae74.tar
unitd-144991354372ae010c84ec7d9efecb03ad3fae74.zip
add validation for hotplug commands
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
-rw-r--r--hotplug-rule.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/hotplug-rule.c b/hotplug-rule.c
index a2d8892..7508b1d 100644
--- a/hotplug-rule.c
+++ b/hotplug-rule.c
@@ -379,6 +379,11 @@ static int cmd_process_strings(struct blob_attr *attr, struct blob_attr *msg)
if (args++ < 0)
continue;
+ if (blobmsg_type(cur) != BLOBMSG_TYPE_STRING) {
+ rule_error(attr, "Invalid argument in command");
+ return -1;
+ }
+
cmd_add_string(blobmsg_data(cur), msg);
}
@@ -398,7 +403,10 @@ static int __rule_process_cmd(struct blob_attr *cur, struct blob_attr *msg)
return ret;
name = blobmsg_data(blobmsg_data(cur));
- cmd_process_strings(cur, msg);
+ ret = cmd_process_strings(cur, msg);
+ if (ret)
+ return ret;
+
rule_handle_command(name, blob_data(b.head));
return 0;