mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-12-08 23:03:46 +00:00
35 lines
1.3 KiB
Diff
35 lines
1.3 KiB
Diff
From 0c3c42847da2f614f1a3f93c7cc96cd241e17e3a Mon Sep 17 00:00:00 2001
|
|
From: Lennart Poettering <lennart@poettering.net>
|
|
Date: Fri, 12 Dec 2014 02:49:40 +0100
|
|
Subject: [PATCH] nspawn: properly validate machine names
|
|
|
|
---
|
|
src/nspawn/nspawn.c | 8 +++-----
|
|
1 file changed, 3 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
|
|
index 0466ddb..e1e1c36 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;
|
|
--
|
|
2.3.0
|
|
|