projects
/
ccan
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9aa2e32
)
ciniparser: Add a check that len remains within bounds.
author
Andreas Schlick
<schlick@lavabit.com>
Tue, 26 Apr 2011 15:07:49 +0000
(17:07 +0200)
committer
Rusty Russell
<rusty@rustcorp.com.au>
Wed, 27 Apr 2011 05:43:02 +0000
(15:13 +0930)
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
patch
|
blob
|
history
diff --git
a/ccan/ciniparser/ciniparser.c
b/ccan/ciniparser/ciniparser.c
index d28c15817e10de530ef43e05744d56106ae0fef9..2b60e409bd7ac7259d2e5245fd457e8087ed7472 100644
(file)
--- 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 (l
en >= 0 && l
ine[len] == '\\') {
/* Multi-line value */
last = len;
continue;