]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Use new logic of regexp escaping
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 14 Feb 2019 17:27:18 +0000 (17:27 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 14 Feb 2019 17:28:19 +0000 (17:28 +0000)
src/libutil/multipattern.c

index e4a39d5fee8b505f97b454234d111fac8a6ef900..c1d0d6499b0d6f15be821b023ef38e74cdd0fada 100644 (file)
@@ -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,