Skip to content

Commit 586a22d

Browse files
committed
literal->data is probably NULL terminated, but just in case let's check literal->len first.
1 parent a1d171a commit 586a22d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/inlines.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1144,7 +1144,7 @@ static cmark_node *handle_close_bracket(cmark_parser *parser, subject *subj) {
11441144
// look back to the opening '[', and skip ahead to the next character
11451145
// if we're looking at a '[^' sequence, and there is other text or nodes
11461146
// after the ^, let's call it a footnote reference.
1147-
if (literal->data[0] == '^' && (literal->len > 1 || opener->inl_text->next->next)) {
1147+
if ((literal->len > 0 && literal->data[0] == '^') && (literal->len > 1 || opener->inl_text->next->next)) {
11481148

11491149
// Before we got this far, the `handle_close_bracket` function may have
11501150
// advanced the current state beyond our footnote's actual closing

0 commit comments

Comments
 (0)