summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorNatanael Copa <natanael.copa@gmail.com>2010-10-14 06:35:07 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2010-10-14 15:00:00 +0200
commit6e74339e7d762857579169068b060a4fd3f345c4 (patch)
tree502b64440eef047216a8dd401fad1d3a8ed13b3e /libc
parentc7c7ea92be00a9b5b48d1243bb75d32390263159 (diff)
parse_config: discard rest of incomplete line
If line is longer then size of given buffer and buffer is not allocated by the config parser itself, then discard rest of line. Signed-off-by: Natanael Copa <natanael.copa@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'libc')
-rw-r--r--libc/misc/internals/parse_config.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libc/misc/internals/parse_config.c b/libc/misc/internals/parse_config.c
index 6d3b6f4a0..c17d25553 100644
--- a/libc/misc/internals/parse_config.c
+++ b/libc/misc/internals/parse_config.c
@@ -79,6 +79,13 @@ static off_t bb_get_chunk_with_continuation(parser_t* parsr)
parsr->data = realloc(parsr->data,
parsr->data_len + parsr->line_len);
parsr->line = parsr->data + parsr->data_len;
+ } else {
+ /* discard rest of line if not enough space in buffer */
+ int c;
+ do {
+ c = fgetc(parsr->fp);
+ } while (c != EOF && c != '\n');
+ break;
}
}
return pos;