commit 6439cbc: [Minor] Do not do urf8 escape for non-utf8 regexps
Vsevolod Stakhov
vsevolod at highsecure.ru
Mon Oct 21 13:49:07 UTC 2019
Author: Vsevolod Stakhov
Date: 2019-10-21 14:44:37 +0100
URL: https://github.com/rspamd/rspamd/commit/6439cbcfe679ebb06b8a09c97c890cb978fc5768 (HEAD -> master)
[Minor] Do not do urf8 escape for non-utf8 regexps
---
src/libserver/re_cache.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/libserver/re_cache.c b/src/libserver/re_cache.c
index 9e84e05d3..88e346cc5 100644
--- a/src/libserver/re_cache.c
+++ b/src/libserver/re_cache.c
@@ -1596,11 +1596,15 @@ rspamd_re_cache_hs_pattern_from_pcre (rspamd_regexp_t *re)
* https://github.com/intel/hyperscan/issues/133
*/
const gchar *pat = rspamd_regexp_get_pattern (re);
+ guint flags = rspamd_regexp_get_flags (re), esc_flags = RSPAMD_REGEXP_ESCAPE_RE;
gchar *escaped;
gsize esc_len;
- escaped = rspamd_str_regexp_escape (pat, strlen (pat), &esc_len,
- RSPAMD_REGEXP_ESCAPE_RE|RSPAMD_REGEXP_ESCAPE_UTF);
+ if (flags & RSPAMD_REGEXP_FLAG_UTF) {
+ esc_flags |= RSPAMD_REGEXP_ESCAPE_UTF;
+ }
+
+ escaped = rspamd_str_regexp_escape (pat, strlen (pat), &esc_len,esc_flags);
return escaped;
}
More information about the Commits
mailing list