aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil/multipattern.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-03-19 13:37:31 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2020-03-19 13:37:31 +0000
commit037260cf1cbc50a7e8953704d39cff327002f163 (patch)
tree04ecc4f84b13bde2ffb62e38660724ce35b08a3a /src/libutil/multipattern.c
parent11ab7477edb01d29f6c9e2c4dfb32dd8ef60bb3e (diff)
downloadrspamd-037260cf1cbc50a7e8953704d39cff327002f163.tar.gz
rspamd-037260cf1cbc50a7e8953704d39cff327002f163.zip
[Minor] Use a more strict pattern for tld lookup
Diffstat (limited to 'src/libutil/multipattern.c')
-rw-r--r--src/libutil/multipattern.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/libutil/multipattern.c b/src/libutil/multipattern.c
index f243c1d8a..c348ac6b2 100644
--- a/src/libutil/multipattern.c
+++ b/src/libutil/multipattern.c
@@ -97,13 +97,13 @@ rspamd_multipattern_escape_tld_hyperscan (const gchar *pattern, gsize slen,
gsize *dst_len)
{
gsize len;
- const gchar *p, *prefix;
+ const gchar *p, *prefix, *suffix;
gchar *res;
/*
* We understand the following cases
- * 1) blah -> .blah
- * 2) *.blah -> ..*\\.blah
+ * 1) blah -> .blah\b
+ * 2) *.blah -> ..*\\.blah\b
* 3) ???
*/
@@ -127,9 +127,13 @@ rspamd_multipattern_escape_tld_hyperscan (const gchar *pattern, gsize slen,
len = slen + strlen (prefix);
}
+ suffix = "\\b";
+ len += strlen (suffix);
+
res = g_malloc (len + 1);
slen = rspamd_strlcpy (res, prefix, len + 1);
slen += rspamd_strlcpy (res + slen, p, len + 1 - slen);
+ slen += rspamd_strlcpy (res + slen, suffix, len + 1 - slen);
*dst_len = slen;