- Commit
- 1f09bfd091eeedbf4ff27e519201ee2c428710c1
- Parent
- 242e277a661ec7e51f34dcaf86c1925d550b1498
- Author
- Nick Wellnhofer <wellnhofer@aevum.de>
- Date
Fix null pointer deref in is_autolink
Introduced by a recent commit. Found by OSS-Fuzz.
My personal build of CMark ✏️
Fix null pointer deref in is_autolink
Introduced by a recent commit. Found by OSS-Fuzz.
1 file changed, 2 insertions, 1 deletion
Status | File Name | N° Changes | Insertions | Deletions |
Modified | src/commonmark.c | 3 | 2 | 1 |
diff --git 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.