summaryrefslogtreecommitdiff
path: root/conf-parser.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-01-27 05:30:38 +0100
committerLennart Poettering <lennart@poettering.net>2010-01-27 05:30:38 +0100
commit1ea86b1803ed7bbb55b31bd9cb780a638a20b2a6 (patch)
tree28cf64699500a85a5e58ad02eadb973d8c4823e3 /conf-parser.c
parent48e11fe8805bf1fcaa9d6231a037eed9cc931a62 (diff)
don't allow comments at the end of lines
Diffstat (limited to 'conf-parser.c')
-rw-r--r--conf-parser.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/conf-parser.c b/conf-parser.c
index 2f013e3f24..0388a24bcc 100644
--- a/conf-parser.c
+++ b/conf-parser.c
@@ -13,6 +13,7 @@
#include "log.h"
#define COMMENTS "#;\n"
+#define NEWLINES "\n\r"
#define LINE_MAX 4096
/* Run the user supplied parser for an assignment */
@@ -77,16 +78,19 @@ static char *strip(char *s) {
/* Parse a variable assignment line */
static int parse_line(const char *filename, unsigned line, char **section, const char* const * sections, const ConfigItem *t, char *l, void *userdata) {
- char *e, *c, *b;
+ char *e, *b, *c;
b = l+strspn(l, WHITESPACE);
- if ((c = strpbrk(b, COMMENTS)))
+ if ((c = strpbrk(b, NEWLINES)))
*c = 0;
if (!*b)
return 0;
+ if (strchr(COMMENTS, *b))
+ return 0;
+
if (startswith(b, ".include ")) {
char *path = NULL, *fn;
int r;