From 6b7fd95fc0b960ed6ab5f004e647aa4a1afea8d5 Mon Sep 17 00:00:00 2001 From: Joseph Heenan Date: Sun, 11 Sep 2016 08:43:58 +0000 Subject: [PATCH] Fix for whitespace lines in config file The while loop was missing a condition to stop at the start of the line, so we'd carry on beyond the start of the buffer. Closes #88 --- conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf.c b/conf.c index e94d682f..8997cdec 100644 --- a/conf.c +++ b/conf.c @@ -1750,7 +1750,7 @@ static struct context **conf_process(struct context **cnt, FILE *fp) /* Trim white space and any CR or LF at the end of the line. */ end = line + strlen(line) - 1; /* Point to the last non-null character in the string. */ - while (*end == ' ' || *end == '\t' || *end == '\n' || *end == '\r') + while (end >= line && (*end == ' ' || *end == '\t' || *end == '\n' || *end == '\r')) end--; *(end+1) = '\0';