summaryrefslogtreecommitdiffstats
path: root/src/libutil
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-06-30 18:26:48 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-06-30 18:26:48 +0100
commit0e85c23ee12fa524ac9056ee0275fd3c4b15c612 (patch)
treeba0fcbe01a55297f9264762022bbfa68daa20559 /src/libutil
parentf826e627cf53496b3ec79be2cc72a5445c89db19 (diff)
downloadrspamd-0e85c23ee12fa524ac9056ee0275fd3c4b15c612.tar.gz
rspamd-0e85c23ee12fa524ac9056ee0275fd3c4b15c612.zip
Fix issues with capturing patterns
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/regexp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libutil/regexp.c b/src/libutil/regexp.c
index 529895b7b..da9884ec1 100644
--- a/src/libutil/regexp.c
+++ b/src/libutil/regexp.c
@@ -335,7 +335,7 @@ fin:
rspamd_regexp_generate_id (pattern, flags, res->id);
/* Check number of captures */
- if (pcre_fullinfo (res->re, res->extra, PCRE_INFO_CAPTURECOUNT,
+ if (pcre_fullinfo (res->raw_re, res->extra, PCRE_INFO_CAPTURECOUNT,
&ncaptures) == 0) {
res->ncaptures = ncaptures;
}
@@ -445,9 +445,9 @@ rspamd_regexp_search (rspamd_regexp_t *re, const gchar *text, gsize len,
g_assert (g_array_get_element_size (captures) ==
sizeof (struct rspamd_re_capture));
- g_array_set_size (captures, rc - 1);
+ g_array_set_size (captures, rc);
- for (i = 0; i < rc - 1; i ++) {
+ for (i = 0; i < rc; i ++) {
elt = &g_array_index (captures, struct rspamd_re_capture, i);
elt->p = mt + ovec[i * 2];
elt->len = (mt + ovec[i * 2 + 1]) - elt->p;