]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Fix hyperscan callback invocation
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 14 Apr 2016 14:11:00 +0000 (15:11 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 14 Apr 2016 14:11:00 +0000 (15:11 +0100)
src/libutil/multipattern.c

index 15c0d641b67bf3123ed1541e68638d5869153758..b3e01330fe0b0f309c7b922c6ec199b3ef75a6d8 100644 (file)
@@ -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;
 }