From: Vsevolod Stakhov Date: Fri, 6 Mar 2015 12:40:15 +0000 (+0000) Subject: Fix some issues in rspamd_regexp. X-Git-Tag: 0.9.0~543 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2868939004792107fa2dae733667ca934b1cd90e;p=rspamd.git Fix some issues in rspamd_regexp. --- diff --git a/src/libutil/regexp.c b/src/libutil/regexp.c index a50148740..444496f45 100644 --- a/src/libutil/regexp.c +++ b/src/libutil/regexp.c @@ -119,7 +119,7 @@ rspamd_regexp_t* rspamd_regexp_new (const gchar *pattern, const gchar *flags, GError **err) { - const gchar *start = pattern, *end, *flags_str, *err_str; + const gchar *start = pattern, *end, *flags_str = NULL, *err_str; rspamd_regexp_t *res; pcre *r; gchar sep = 0, *real_pattern; @@ -151,7 +151,7 @@ rspamd_regexp_new (const gchar *pattern, const gchar *flags, sep, pattern); return NULL; } - flags = end + 1; + flags_str = end + 1; start ++; } } @@ -160,12 +160,12 @@ rspamd_regexp_new (const gchar *pattern, const gchar *flags, strict_flags = TRUE; start = pattern; end = pattern + strlen (pattern); + flags_str = flags; } regexp_flags |= PCRE_UTF8 ; - if (flags != NULL) { - flags_str = flags; + if (flags_str != NULL) { while (*flags_str) { switch (*flags_str) { case 'i': @@ -366,7 +366,7 @@ rspamd_regexp_search (rspamd_regexp_t *re, const gchar *text, gsize len, *start = mt + ovec[0]; } if (end) { - *end = mt + ovec[0] + ovec[1]; + *end = mt + ovec[1]; } if (re->flags & RSPAMD_REGEXP_FLAG_FULL_MATCH) {