diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-12-12 02:49:40 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-12-12 13:35:32 +0100 |
commit | 0c3c42847da2f614f1a3f93c7cc96cd241e17e3a (patch) | |
tree | 8bac16d447473321c5b8d3e28d78d5497822bed3 /src/nspawn | |
parent | a60e9f7fc81558345c59bf203ace357223f208ef (diff) |
nspawn: properly validate machine names
Diffstat (limited to 'src/nspawn')
-rw-r--r-- | src/nspawn/nspawn.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index 0466ddbff3..e1e1c367f0 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -369,15 +369,13 @@ static int parse_argv(int argc, char *argv[]) { free(arg_machine); arg_machine = NULL; } else { - - if (!hostname_is_valid(optarg)) { + if (!machine_name_is_valid(optarg)) { log_error("Invalid machine name: %s", optarg); return -EINVAL; } - free(arg_machine); - arg_machine = strdup(optarg); - if (!arg_machine) + r = free_and_strdup(&arg_machine, optarg); + if (r < 0) return log_oom(); break; |