summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/inlines.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/inlines.c b/src/inlines.c
index 26eb02a..9216979 100644
--- a/src/inlines.c
+++ b/src/inlines.c
@@ -594,7 +594,8 @@ static int link_label(subject* subj, chunk *raw_label)
advance(subj); // advance past [
unsigned char c;
- while ((c = peek_char(subj)) && (c != ']' || nestlevel > 0)) {
+ while ((c = peek_char(subj)) &&
+ (c != ']' || (nestlevel > 0 && nestlevel < STACK_LIMIT))) {
switch (c) {
case '`':
tmp = handle_backticks(subj);
@@ -622,7 +623,7 @@ static int link_label(subject* subj, chunk *raw_label)
advance(subj);
}
}
- if (c == ']') {
+ if (nestlevel == 0 && c == ']') {
*raw_label = chunk_dup(&subj->input, startpos + 1, subj->pos - (startpos + 1));
subj->label_nestlevel = 0;
advance(subj); // advance past ]