diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-01-20 20:14:46 +0100 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-01-20 20:14:46 +0100 |
commit | 664b8603a1b6dc94d199496dc4b372b285fa89fd (patch) | |
tree | de325a66e47f092bf67859969dcd8d2596fd54ef | |
parent | 06156fd9194806ab98889e5ef3a309bb7075b02c (diff) |
Fixed buffer overflow error in S_parser_feed.
The overflow could occur in the following condition:
the buffer ends with `\r` and the next memory address
contains `\n`.
Closes #184.
-rw-r--r-- | src/blocks.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/blocks.c b/src/blocks.c index 99dd082..051d2e8 100644 --- a/src/blocks.c +++ b/src/blocks.c @@ -580,7 +580,7 @@ static void S_parser_feed(cmark_parser *parser, const unsigned char *buffer, if (buffer == end) parser->last_buffer_ended_with_cr = true; } - if (*buffer == '\n') + if (buffer < end && *buffer == '\n') buffer++; } } |