summaryrefslogtreecommitdiff
path: root/src/inlines.c
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-06-02 16:33:02 +0200
committerJohn MacFarlane <jgm@berkeley.edu>2017-06-02 16:33:30 +0200
commit6ec3b485c406bb05ca5e13fe61d84df6b27f1945 (patch)
tree7fe4d4c5ff47f483bd1ccb37ea99212c414c736d /src/inlines.c
parent14ea489f5dd6e3d07e23f104d6c9ce441d05751b (diff)
Properly handle backslashes in link destinations.
Only ascii punctuation characters are escapable, per the spec. Closes #192.
Diffstat (limited to 'src/inlines.c')
-rw-r--r--src/inlines.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/inlines.c b/src/inlines.c
index 021d5a3..eea0631 100644
--- a/src/inlines.c
+++ b/src/inlines.c
@@ -842,7 +842,9 @@ static bufsize_t manual_scan_link_url(cmark_chunk *input, bufsize_t offset) {
}
} else {
while (i < input->len) {
- if (input->data[i] == '\\')
+ if (input->data[i] == '\\' &&
+ i + 1 < input-> len &&
+ cmark_ispunct(input->data[i+1]))
i += 2;
else if (input->data[i] == '(') {
++nb_p;