summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-03-30 22:32:30 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2015-03-30 22:33:36 -0700
commit87d66880803c9362f135d894652f6d0ed50b73bc (patch)
tree47a2f3f59333475874cfdc3739263f85fd19a794
parentd4047b95a4d8564ef6959a4fb63fc2e2e0708399 (diff)
Fixed memory issue.
This fixes valgrind "invalid read of size 1" on input `[link](<>)`.
-rw-r--r--src/inlines.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/inlines.c b/src/inlines.c
index e2641a7..3e298de 100644
--- a/src/inlines.c
+++ b/src/inlines.c
@@ -636,7 +636,7 @@ unsigned char *cmark_clean_url(cmark_chunk *url)
}
cmark_strbuf_unescape(&buf);
- return cmark_strbuf_detach(&buf);
+ return buf.size == 0 ? NULL : cmark_strbuf_detach(&buf);
}
unsigned char *cmark_clean_title(cmark_chunk *title)
@@ -660,7 +660,7 @@ unsigned char *cmark_clean_title(cmark_chunk *title)
}
cmark_strbuf_unescape(&buf);
- return cmark_strbuf_detach(&buf);
+ return buf.size == 0 ? NULL : cmark_strbuf_detach(&buf);
}
// Parse an autolink or HTML tag.