mirror of
https://github.com/troglobit/finit.git
synced 2026-10-23 11:44:37 +00:00
service: support quoted arguments to run/task/service options
Fixes #441 Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
2 files changed
+95
-2
No files matched your search
@@ -88,6 +88,21 @@ static void cgset(const char *path, char *ctrl, char *prop)
|
||||
}
|
||||
*val++ = 0;
|
||||
|
||||
/* unquote value, if quoted */
|
||||
if (val[0] == '"' || val[0] == '\'') {
|
||||
char q = val[0];
|
||||
char *end;
|
||||
|
||||
end = strchr(&val[1], q);
|
||||
if (!end) {
|
||||
errx(1, "Syntax error, unterminated quote in %s/%s.%s=%s", path, ctrl, prop, val);
|
||||
return;
|
||||
}
|
||||
|
||||
val++;
|
||||
*end = 0;
|
||||
}
|
||||
|
||||
/* disallow sneaky relative paths */
|
||||
if (strstr(ctrl, "..") || strstr(prop, "..")) {
|
||||
errx(1, "Possible security violation; '..' not allowed in cgroup config!");
|
||||
|
||||
Reference in new issue
Block a user