]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
conf-parser: refuse section headers with control characters early, just in case
authorLennart Poettering <lennart@poettering.net>
Wed, 9 Feb 2022 08:47:53 +0000 (09:47 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 9 Feb 2022 09:17:20 +0000 (10:17 +0100)
src/shared/conf-parser.c

index ebbfa0d6c26ab0e6e46377c879c668f7278b25dd..dbf5cc2fcd45bd740fd49ec21e5224ecae1ef2fe 100644 (file)
@@ -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;