From 5d16af6b134477d0e9b281cd1e9d962dc52b5088 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 29 Nov 2014 12:56:13 -0800 Subject: Check for `[` character in `link_label`. Closes #226. --- src/inlines.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/inlines.c b/src/inlines.c index e08b757..2d26e81 100644 --- a/src/inlines.c +++ b/src/inlines.c @@ -617,9 +617,15 @@ static int link_label(subject* subj, chunk *raw_label) { int startpos = subj->pos; int length = 0; - - advance(subj); // advance past [ unsigned char c; + + // advance past [ + if (peek_char(subj) == '[') { + advance(subj); + } else { + return 0; + } + while ((c = peek_char(subj)) && c != '[' && c != ']') { if (c == '\\') { advance(subj); -- cgit v1.2.3