summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2020-01-25 10:49:59 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2020-01-25 09:39:32 -0800
commit1f09bfd091eeedbf4ff27e519201ee2c428710c1 (patch)
tree824dd05984c3c81ff6f0670b7d9a6220ab066d81
parent242e277a661ec7e51f34dcaf86c1925d550b1498 (diff)
Fix null pointer deref in is_autolink
Introduced by a recent commit. Found by OSS-Fuzz.
-rw-r--r--src/commonmark.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/commonmark.c b/src/commonmark.c
index cc12bb4..cb926c5 100644
--- a/src/commonmark.c
+++ b/src/commonmark.c
@@ -146,7 +146,8 @@ static bool is_autolink(cmark_node *node) {
if (strcmp((const char *)url, "mailto:") == 0) {
url += 7;
}
- return strcmp((const char *)url, (char *)link_text->data) == 0;
+ return link_text->data != NULL &&
+ strcmp((const char *)url, (char *)link_text->data) == 0;
}
// if node is a block node, returns node.