diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-02-14 17:27:18 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-02-14 17:28:19 +0000 |
commit | ec6e8f945f6a1fb6a2efc2bd17b3545cd7b3b3b6 (patch) | |
tree | da63a2729491dd1546a6b08ae473443d6e7d5ed1 /src | |
parent | 9b2e2d70a83c5c679f917253bcdb733d4bbbe705 (diff) | |
download | rspamd-ec6e8f945f6a1fb6a2efc2bd17b3545cd7b3b3b6.tar.gz rspamd-ec6e8f945f6a1fb6a2efc2bd17b3545cd7b3b3b6.zip |
[Minor] Use new logic of regexp escaping
Diffstat (limited to 'src')
-rw-r--r-- | src/libutil/multipattern.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/libutil/multipattern.c b/src/libutil/multipattern.c index e4a39d5fe..c1d0d6499 100644 --- a/src/libutil/multipattern.c +++ b/src/libutil/multipattern.c @@ -116,11 +116,11 @@ rspamd_multipattern_escape_tld_hyperscan (const gchar *pattern, gsize slen, p ++; } - prefix = "\\..*\\."; + prefix = ".*"; } else { len = slen + 2; - prefix = "\\."; + prefix = "."; p = pattern; } @@ -200,11 +200,18 @@ rspamd_multipattern_pattern_filter (const gchar *pattern, gsize len, } if (flags & RSPAMD_MULTIPATTERN_TLD) { - ret = rspamd_multipattern_escape_tld_hyperscan (pattern, len, dst_len); + gchar *tmp; + gsize tlen; + tmp = rspamd_multipattern_escape_tld_hyperscan (pattern, len, &tlen); + + ret = rspamd_str_regexp_escape (tmp, tlen, dst_len, + gl_flags|RSPAMD_REGEXP_ESCAPE_GLOB); + g_free (tmp); } else if (flags & RSPAMD_MULTIPATTERN_RE) { ret = malloc (len + 1); - *dst_len = rspamd_strlcpy (ret, pattern, len + 1); + ret = rspamd_str_regexp_escape (pattern, len, dst_len, gl_flags | + RSPAMD_REGEXP_ESCAPE_RE); } else if (flags & RSPAMD_MULTIPATTERN_GLOB) { ret = rspamd_str_regexp_escape (pattern, len, dst_len, |