]> source.dussan.org Git - rspamd.git/commitdiff
Fix critical bug on matching regular expressions.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 19 May 2015 12:32:09 +0000 (13:32 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 19 May 2015 12:32:09 +0000 (13:32 +0100)
Issue: #186
Reported by: @moisseev

src/libutil/regexp.c

index 15d83dd44e75406ede0f5c62593ce11a09835c49..6bcdea67ddc4e96fde25b4d253a0aa181e9a6cb4 100644 (file)
@@ -177,6 +177,7 @@ rspamd_regexp_new (const gchar *pattern, const gchar *flags,
        }
 
        rspamd_flags |= RSPAMD_REGEXP_FLAG_RAW;
+       regexp_flags |= PCRE_NO_AUTO_CAPTURE;
        regexp_flags &= ~PCRE_UTF8;
 
        if (flags_str != NULL) {
@@ -421,7 +422,7 @@ rspamd_regexp_search (rspamd_regexp_t *re, const gchar *text, gsize len,
                rc = pcre_exec (r, ext, mt, remain, 0, match_flags, ovec,
                                G_N_ELEMENTS (ovec));
        }
-       if (rc > 0) {
+       if (rc >= 0) {
                if (start) {
                        *start = mt + ovec[0];
                }