diff options
author | Yuki Izumi <kivikakk@github.com> | 2016-10-11 01:43:33 +1100 |
---|---|---|
committer | Yuki Izumi <kivikakk@github.com> | 2016-10-11 01:43:33 +1100 |
commit | 920cbd071a85ffabefdb706c257b7c49620fc896 (patch) | |
tree | aca99ba07ec025e752b952307cf91e6ebd0a9ab3 /src | |
parent | 8f80fb336984ccd1f42076c722caec2292092904 (diff) |
Fix by not advancing past both \0 and \n
Diffstat (limited to 'src')
-rw-r--r-- | src/blocks.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/blocks.c b/src/blocks.c index 3c21fbf..a88c168 100644 --- a/src/blocks.c +++ b/src/blocks.c @@ -563,7 +563,6 @@ static void S_parser_feed(cmark_parser *parser, const unsigned char *buffer, cmark_strbuf_put(&parser->linebuf, buffer, chunk_len); // add replacement character cmark_strbuf_put(&parser->linebuf, repl, 3); - chunk_len += 1; // so we advance the buffer past NULL } else { cmark_strbuf_put(&parser->linebuf, buffer, chunk_len); } @@ -576,7 +575,9 @@ static void S_parser_feed(cmark_parser *parser, const unsigned char *buffer, if (buffer == end) parser->last_buffer_ended_with_cr = true; } - if (buffer < end && *buffer == '\n') + if (buffer < end && *buffer == '\0') + buffer++; + else if (buffer < end && *buffer == '\n') buffer++; } } |