commit ec6e8f9: [Minor] Use new logic of regexp escaping
Vsevolod Stakhov
vsevolod at highsecure.ru
Thu Feb 14 17:35:07 UTC 2019
Author: Vsevolod Stakhov
Date: 2019-02-14 17:27:18 +0000
URL: https://github.com/rspamd/rspamd/commit/ec6e8f945f6a1fb6a2efc2bd17b3545cd7b3b3b6
[Minor] Use new logic of regexp escaping
---
src/libutil/multipattern.c | 15 +++++++++++----
1 file 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,
More information about the Commits
mailing list