From: Vsevolod Stakhov Date: Thu, 14 Apr 2016 14:11:00 +0000 (+0100) Subject: [Fix] Fix hyperscan callback invocation X-Git-Tag: 1.2.4~40 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a56acc7f91d27a35b7d05d5f4ad5ba989e98612;p=thirdparty%2Frspamd.git [Fix] Fix hyperscan callback invocation --- diff --git a/src/libutil/multipattern.c b/src/libutil/multipattern.c index 15c0d641b6..b3e01330fe 100644 --- a/src/libutil/multipattern.c +++ b/src/libutil/multipattern.c @@ -499,12 +499,14 @@ rspamd_multipattern_hs_cb (unsigned int id, void *ud) { struct rspamd_multipattern_cbdata *cbd = ud; - gint ret; + gint ret = 0; - ret = cbd->cb (cbd->mp, id, from, to, cbd->in, cbd->len, cbd->ud); + if (to > 0) { + ret = cbd->cb (cbd->mp, id, from, to - 1, cbd->in, cbd->len, cbd->ud); - cbd->nfound ++; - cbd->ret = ret; + cbd->nfound ++; + cbd->ret = ret; + } return ret; }