aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-11-29 12:56:13 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2014-11-29 12:56:13 -0800
commit5d16af6b134477d0e9b281cd1e9d962dc52b5088 (patch)
tree854ceba944505fc3faeb4ce1a81f76de69d7a77c
parentd8226ea031f61572f397af0735ec32c6ab0a231a (diff)
Check for `[` character in `link_label`.
Closes #226.
-rw-r--r--src/inlines.c10
1 files 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);