From 90cc2d3b54b7cf6253d9cc467f4a540005a6fa5d Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 19 May 2015 13:32:09 +0100 Subject: [PATCH] Fix critical bug on matching regular expressions. Issue: #186 Reported by: @moisseev --- src/libutil/regexp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libutil/regexp.c b/src/libutil/regexp.c index 15d83dd44..6bcdea67d 100644 --- a/src/libutil/regexp.c +++ b/src/libutil/regexp.c @@ -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]; } -- 2.39.5