diff options
author | Phil Turnbull <philipturnbull@github.com> | 2017-06-26 15:26:56 -0400 |
---|---|---|
committer | Phil Turnbull <philipturnbull@github.com> | 2017-06-27 15:37:04 -0400 |
commit | a2f1f76dc38a34d0e3d97f75d1fee527931b6e8a (patch) | |
tree | 8bbe02cdfdd4720cce9c69f2f552775338f66038 | |
parent | c1dea4ee507ef62b121051e34e36a9b24459ea39 (diff) |
Check for NULL pointer in get_link_type
echo '[](xx:)' | ./build/src/cmark -t latex
Segmentation fault: 11
-rw-r--r-- | src/latex.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/latex.c b/src/latex.c index 9bd6444..22052d7 100644 --- a/src/latex.c +++ b/src/latex.c @@ -179,6 +179,10 @@ static link_type get_link_type(cmark_node *node) { link_text = node->first_child; cmark_consolidate_text_nodes(link_text); + + if (!link_text) + return NO_LINK; + realurl = (char *)url; realurllen = (int)url_len; if (strncmp(realurl, "mailto:", 7) == 0) { |