From cec7f09dc8beb21afcae981dbe3543686f793810 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 9 Feb 2022 09:47:53 +0100 Subject: [PATCH] conf-parser: refuse section headers with control characters early, just in case --- src/shared/conf-parser.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c index ebbfa0d6c2..dbf5cc2fcd 100644 --- a/src/shared/conf-parser.c +++ b/src/shared/conf-parser.c @@ -194,6 +194,9 @@ static int parse_line( if (!n) return log_oom(); + if (!string_is_safe(n)) + return log_syntax(unit, LOG_ERR, filename, line, SYNTHETIC_ERRNO(EBADMSG), "Bad characters in section header '%s'", l); + if (sections && !nulstr_contains(sections, n)) { bool ignore; const char *t;