summaryrefslogtreecommitdiff
path: root/logsrvd
diff options
context:
space:
mode:
authorTodd C. Miller <Todd.Miller@sudo.ws>2022-01-29 10:50:03 -0700
committerTodd C. Miller <Todd.Miller@sudo.ws>2022-01-29 10:50:03 -0700
commit12e0f13469aff87999da470d34c0506bee77f2db (patch)
treeac2fee70fa21dfbebcbcad6e2c843cbd21d7b283 /logsrvd
parentf52d9d8c39d9c62786de3976519c93690bbbbb23 (diff)
downloadsudo-12e0f13469aff87999da470d34c0506bee77f2db.tar.gz
Check for garbage after [section] in sudo_logsrvd.conf.
Diffstat (limited to 'logsrvd')
-rw-r--r--logsrvd/logsrvd_conf.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/logsrvd/logsrvd_conf.c b/logsrvd/logsrvd_conf.c
index 993c4b4f6..ec67d5392 100644
--- a/logsrvd/logsrvd_conf.c
+++ b/logsrvd/logsrvd_conf.c
@@ -1169,14 +1169,21 @@ logsrvd_conf_parse(struct logsrvd_config *config, FILE *fp, const char *path)
/* New section */
if (line[0] == '[') {
- char *section_name = line + 1;
- char *cp = strchr(section_name, ']');
- if (cp == NULL) {
+ char *cp, *section_name = line + 1;
+
+ if ((ep = strchr(section_name, ']')) == NULL) {
sudo_warnx(U_("%s:%d unmatched '[': %s"),
path, lineno, line);
goto done;
}
- *cp = '\0';
+ for (cp = ep + 1; *cp != '\0'; cp++) {
+ if (!isspace((unsigned char)*cp)) {
+ sudo_warnx(U_("%s:%d garbage after ']': %s"),
+ path, lineno, line);
+ goto done;
+ }
+ }
+ *ep = '\0';
for (conf_section = logsrvd_config_sections; conf_section->name != NULL;
conf_section++) {
if (strcasecmp(section_name, conf_section->name) == 0)