service: support quoted arguments to run/task/service options

Fixes #441

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2025-07-02 14:27:39 +02:00
1 parent 2760616c73
commit ecb690c9ec
2 files changed
+95 -2

No files matched your search

+15
View File
@@ -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!");