From: Felix Fietkau Date: Wed, 13 Feb 2013 16:11:30 +0000 (+0100) Subject: hotplug: add extra validation for commands X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=4d326e16578fa2992f3bb6ab21775d4db03558d4;p=oweals%2Fprocd.git hotplug: add extra validation for commands Signed-off-by: Felix Fietkau --- 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;