aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-04-06 18:28:34 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-04-06 18:28:34 +0100
commit2ea8eb7009086d3d932b0e38b83146aa949d4eac (patch)
tree4d63450e31fbfb21e440105a7748eb9f1db9441a
parent34690b4854c04bb5a459aae7ff7b09125b6711e4 (diff)
downloadrspamd-2ea8eb7009086d3d932b0e38b83146aa949d4eac.tar.gz
rspamd-2ea8eb7009086d3d932b0e38b83146aa949d4eac.zip
Some more fixes to actrie match.
-rw-r--r--src/libserver/url.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/libserver/url.c b/src/libserver/url.c
index 43ce4c68f..a0004d740 100644
--- a/src/libserver/url.c
+++ b/src/libserver/url.c
@@ -1909,22 +1909,24 @@ rspamd_url_trie_callback (int strnum, int textpos, void *context)
url_match_t m;
const gchar *pos;
struct url_callback_data *cb = context;
+ ac_trie_pat_t *pat;
matcher = &g_array_index (url_scanner->matchers, struct url_matcher, strnum);
if ((matcher->flags & URL_FLAG_NOHTML) && cb->is_html) {
/* Do not try to match non-html like urls in html texts */
return 0;
}
+ pat = &g_array_index (url_scanner->patterns, ac_trie_pat_t, strnum);
m.pattern = matcher->pattern;
m.prefix = matcher->prefix;
m.add_prefix = FALSE;
- pos = cb->begin + textpos;
+ pos = cb->begin + textpos - pat->len;
if (matcher->start (cb->begin, cb->end, pos,
&m) && matcher->end (cb->begin, cb->end, pos, &m)) {
if (m.add_prefix || matcher->prefix[0] != '\0') {
- cb->len = m.m_len + strlen (m.prefix);
+ cb->len = m.m_len + strlen (matcher->prefix) + 1;
cb->url_str = rspamd_mempool_alloc (cb->pool, cb->len + 1);
rspamd_snprintf (cb->url_str,
cb->len,
@@ -1938,8 +1940,8 @@ rspamd_url_trie_callback (int strnum, int textpos, void *context)
rspamd_strlcpy (cb->url_str, m.m_begin, m.m_len + 1);
}
- cb->start = (gchar *)m.m_begin;
- cb->fin = (gchar *)m.m_begin + m.m_len;
+ cb->start = m.m_begin;
+ cb->fin = m.m_begin + m.m_len;
return 1;
}