diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-08-23 14:33:50 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-08-24 22:46:45 +0200 |
commit | b9a8d250810d4803bc9bf6b36932b528cb991d1e (patch) | |
tree | 6843e538235d3c6c79a951984ff8d3f4bb5e1930 /src/basic | |
parent | 25300b5a1fcf54674a69d0f4ab08925be00b0227 (diff) |
machined: validate machine names at more places
When enumerating machines from /run, and when accepting machine names
for operations, be more strict and always validate.
Note that these checks are strictly speaking unnecessary, since
enumeration happens only on the trusted /run...
Diffstat (limited to 'src/basic')
-rw-r--r-- | src/basic/util.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/basic/util.c b/src/basic/util.c index deff68073c..f752595ca1 100644 --- a/src/basic/util.c +++ b/src/basic/util.c @@ -4913,6 +4913,9 @@ int container_get_leader(const char *machine, pid_t *pid) { assert(machine); assert(pid); + if (!machine_name_is_valid(machine)) + return -EINVAL; + p = strjoina("/run/systemd/machines/", machine); r = parse_env_file(p, NEWLINE, "LEADER", &s, "CLASS", &class, NULL); if (r == -ENOENT) |