From 5c922794aa81cb2a62a034552f6478074b4dda14 Mon Sep 17 00:00:00 2001 From: Andreas Schlick Date: Tue, 26 Apr 2011 17:07:49 +0200 Subject: [PATCH] ciniparser: Add a check that len remains within bounds. If the line is made solely of whitespaces, they get removed and we end up with len set to -1. Therefore we need an additional check to avoid dereferencing line[-1]. --- ccan/ciniparser/ciniparser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ccan/ciniparser/ciniparser.c b/ccan/ciniparser/ciniparser.c index d28c1581..2b60e409 100644 --- a/ccan/ciniparser/ciniparser.c +++ b/ccan/ciniparser/ciniparser.c @@ -423,7 +423,7 @@ dictionary *ciniparser_load(const char *ininame) } /* Detect multi-line */ - if (line[len] == '\\') { + if (len >= 0 && line[len] == '\\') { /* Multi-line value */ last = len; continue; -- 2.39.2