nspawn: properly validate machine names

This commit is contained in:
Lennart Poettering
2014-12-12 13:35:32 +01:00
parent a60e9f7fc8
commit 0c3c42847d
+3 -5
View File
@@ -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;