diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-01-22 16:46:42 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-01-22 16:46:42 +0000 |
commit | bbbfedc8a55a7a4965bc5d5e1d1d5fbaff00294a (patch) | |
tree | 1591efcc498d19ab15fb8e372ba6bf97624656c7 | |
parent | 52fd861c1bedad63595b57ce228295dc4dd113c5 (diff) | |
download | rspamd-bbbfedc8a55a7a4965bc5d5e1d1d5fbaff00294a.tar.gz rspamd-bbbfedc8a55a7a4965bc5d5e1d1d5fbaff00294a.zip |
[Minor] Fix core dump when cannot extract tld in href url
-rw-r--r-- | src/libserver/url.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/libserver/url.c b/src/libserver/url.c index 3a08ec748..018ab78c3 100644 --- a/src/libserver/url.c +++ b/src/libserver/url.c @@ -1794,10 +1794,17 @@ rspamd_url_parse (struct rspamd_url *uri, uri->host, uri->hostlen, rspamd_tld_trie_callback, uri, NULL); - if (!(parse_flags & RSPAMD_URL_PARSE_HREF) && uri->tldlen == 0) { - /* Ignore URL's without TLD if it is not a numeric URL */ - if (!rspamd_url_is_ip (uri, pool)) { - return URI_ERRNO_TLD_MISSING; + if (uri->tldlen == 0) { + if (!(parse_flags & RSPAMD_URL_PARSE_HREF)) { + /* Ignore URL's without TLD if it is not a numeric URL */ + if (!rspamd_url_is_ip (uri, pool)) { + return URI_ERRNO_TLD_MISSING; + } + } + else { + /* Assume tld equal to host */ + uri->tld = uri->host; + uri->tldlen = uri->hostlen; } } |