Browse Source

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].
Andreas Schlick 15 years ago
parent
commit
5c922794aa
1 changed files with 1 additions and 1 deletions
  1. 1 1
      ccan/ciniparser/ciniparser.c

+ 1 - 1
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;