From 920cbd071a85ffabefdb706c257b7c49620fc896 Mon Sep 17 00:00:00 2001 From: Yuki Izumi Date: Tue, 11 Oct 2016 01:43:33 +1100 Subject: Fix by not advancing past both \0 and \n --- src/blocks.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') 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++; } } -- cgit v1.2.3