cmark

My personal build of CMark ✏️

Commit
664b8603a1b6dc94d199496dc4b372b285fa89fd
Parent
06156fd9194806ab98889e5ef3a309bb7075b02c
Author
John MacFarlane <jgm@berkeley.edu>
Date

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.

Diffstat

1 file changed, 1 insertion, 1 deletion

Status File Name N° Changes Insertions Deletions
Modified src/blocks.c 2 1 1
diff --git 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++;
       }
     }