From 163c76c9305e6fee91dad8a3004f77020000ef96 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 6 Oct 2015 12:32:31 +0200 Subject: activate: validate fdname when accepting it --- src/activate/activate.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/activate/activate.c b/src/activate/activate.c index 6a8432314e..4ece1367c1 100644 --- a/src/activate/activate.c +++ b/src/activate/activate.c @@ -361,6 +361,11 @@ static int parse_argv(int argc, char *argv[]) { break; case ARG_FDNAME: + if (!fdname_is_valid(optarg)) { + log_error("File descriptor name %s is not valid, refusing.", optarg); + return -EINVAL; + } + arg_fdname = optarg; break; -- cgit v1.2.3-54-g00ecf From 5b7003708352c59b44311cd19c6746f9047ad140 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 6 Oct 2015 12:32:50 +0200 Subject: strv: properly return ENOMEM where we should in strv_extend_n() --- src/basic/strv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/basic/strv.c b/src/basic/strv.c index 90f0b8c741..d5169467da 100644 --- a/src/basic/strv.c +++ b/src/basic/strv.c @@ -784,5 +784,5 @@ rollback: free(nl[j]); nl[k] = NULL; - return NULL; + return -ENOMEM; } -- cgit v1.2.3-54-g00ecf From 0a3bb96e2c77af78e31e497c791cb110e740ad59 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 6 Oct 2015 12:33:14 +0200 Subject: util: some comment fixes in fdname_is_valid() --- src/basic/util.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/basic/util.c b/src/basic/util.c index 630c7ea9ff..2855993afe 100644 --- a/src/basic/util.c +++ b/src/basic/util.c @@ -6849,12 +6849,14 @@ int version(void) { bool fdname_is_valid(const char *s) { const char *p; - /* Validates a name for $LISTEN_NAMES. We basically allow + /* Validates a name for $LISTEN_FDNAMES. We basically allow * everything ASCII that's not a control character. Also, as * special exception the ":" character is not allowed, as we - * use that as field separator in $LISTEN_NAMES. + * use that as field separator in $LISTEN_FDNAMES. * - * Note that the empty string is explicitly allowed here.*/ + * Note that the empty string is explicitly allowed + * here. However, we limit the length of the names to 255 + * characters. */ if (!s) return false; -- cgit v1.2.3-54-g00ecf