From 11ca56b853bebb6cec3fa89fc183ac83e1a2f35e Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 14 Apr 2016 15:45:10 +0100 Subject: [PATCH] [Fix] Further fixes to urls parsing --- src/libserver/url.c | 8 ++++++-- src/libutil/multipattern.c | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/libserver/url.c b/src/libserver/url.c index d5bddcfb5..9d6ec34bf 100644 --- a/src/libserver/url.c +++ b/src/libserver/url.c @@ -1947,6 +1947,7 @@ url_email_end (struct url_callback_data *cb, return TRUE; } else { +#ifndef WITH_HYPERSCAN /* * Here we have just '@', so we need to find both start and end of the * pattern @@ -1990,6 +1991,9 @@ url_email_end (struct url_callback_data *cb, match->m_len = p - c; return TRUE; } +#else + return TRUE; +#endif } return FALSE; @@ -2144,7 +2148,7 @@ rspamd_url_trie_generic_callback_common (struct rspamd_multipattern *mp, return 0; } - pos = text + match_pos; + pos = text + match_start; if (!rspamd_url_trie_is_match (matcher, pos, text + len)) { return 0; @@ -2175,7 +2179,7 @@ rspamd_url_trie_generic_callback_common (struct rspamd_multipattern *mp, cb->fin = m.m_begin + m.m_len; url = rspamd_mempool_alloc0 (pool, sizeof (struct rspamd_url)); g_strstrip (cb->url_str); - rc = rspamd_url_parse (url, cb->url_str, m.m_len + 1, pool); + rc = rspamd_url_parse (url, cb->url_str, m.m_len, pool); if (rc == URI_ERRNO_OK && url->hostlen > 0) { if (cb->func) { diff --git a/src/libutil/multipattern.c b/src/libutil/multipattern.c index f6a017047..d8cbd77d9 100644 --- a/src/libutil/multipattern.c +++ b/src/libutil/multipattern.c @@ -507,7 +507,7 @@ rspamd_multipattern_hs_cb (unsigned int id, from = 0; } - ret = cbd->cb (cbd->mp, id, from, to - 1, cbd->in, cbd->len, cbd->ud); + ret = cbd->cb (cbd->mp, id, from, to, cbd->in, cbd->len, cbd->ud); cbd->nfound ++; cbd->ret = ret; -- 2.39.5