From a45141c003e065341474de0ec0b4310b2f4437c8 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 20 Nov 2018 20:44:49 +0000 Subject: [Fix] Properly escape utf8 regexps in hyperscan mode --- src/libutil/str_util.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/libutil/str_util.h') diff --git a/src/libutil/str_util.h b/src/libutil/str_util.h index 100b64b88..ffcc69197 100644 --- a/src/libutil/str_util.h +++ b/src/libutil/str_util.h @@ -396,6 +396,11 @@ rspamd_str_has_8bit (const guchar *beg, gsize len) gboolean rspamd_normalise_unicode_inplace (rspamd_mempool_t *pool, gchar *start, guint *len); +enum rspamd_regexp_escape_flags { + RSPAMD_REGEXP_ESCAPE_ASCII = 0, + RSPAMD_REGEXP_ESCAPE_UTF = 1u << 0, + RSPAMD_REGEXP_ESCAPE_GLOB = 1u << 1, +}; /** * Escapes special characters when reading plain data to be processed in pcre * @param pattern pattern to process @@ -406,6 +411,6 @@ gboolean rspamd_normalise_unicode_inplace (rspamd_mempool_t *pool, */ gchar * rspamd_str_regexp_escape (const gchar *pattern, gsize slen, - gsize *dst_len, gboolean allow_glob); + gsize *dst_len, enum rspamd_regexp_escape_flags flags); #endif /* SRC_LIBUTIL_STR_UTIL_H_ */ -- cgit v1.2.3