dend = result->regexp_text + (end - start);
*dend = '\0';
- result->regexp = rspamd_regexp_new (dbegin, re_flags->str,
+ gsize esc_len;
+ gchar *escaped = rspamd_str_regexp_escape (dbegin, dend - dbegin, &esc_len,
+ RSPAMD_REGEXP_ESCAPE_UTF);
+
+ result->regexp = rspamd_regexp_new (escaped, re_flags->str,
&err);
+ g_free (escaped);
g_string_free (re_flags, TRUE);
if (result->regexp == NULL || err != NULL) {
gchar *
rspamd_str_regexp_escape (const gchar *pattern, gsize slen,
- gsize *dst_len, enum rspamd_regexp_escape_flags flags)
+ gsize *dst_len, enum rspamd_regexp_escape_flags flags)
{
const gchar *p, *end = pattern + slen;
gchar *res, *d, t, *tmp_utf = NULL, *dend;
*/
gchar *
rspamd_str_regexp_escape (const gchar *pattern, gsize slen,
- gsize *dst_len, enum rspamd_regexp_escape_flags flags);
+ gsize *dst_len, enum rspamd_regexp_escape_flags flags);
/**
* Returns copy of src (zero terminated) where all unicode is made valid or replaced