From 3832cd7c84a67d396022d5969b649dbe47dfda97 Mon Sep 17 00:00:00 2001 From: Tomasz Kojm Date: Mon, 6 Aug 2007 12:05:42 +0000 Subject: [PATCH] fix matching of patterns with prefixes and some other issues git-svn: trunk@3164 --- ChangeLog | 5 +++++ libclamav/matcher-ac.c | 9 ++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index a1d4e737c..2ec394b56 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Aug 6 13:16:39 CEST 2007 (tk) +---------------------------------- + * libclamav/matcher-ac.c: fix matching of patterns with prefixes and some + other issues spotted by Glen + Fri Aug 3 09:21:12 BST 2007 (njh) ---------------------------------- * clamav-milter/clamav-milter.c: Better use of res_init() diff --git a/libclamav/matcher-ac.c b/libclamav/matcher-ac.c index a09665b47..96609fdb8 100644 --- a/libclamav/matcher-ac.c +++ b/libclamav/matcher-ac.c @@ -517,12 +517,11 @@ int cli_ac_scanbuff(const unsigned char *buffer, uint32_t length, const char **v } if(pt->partno == 1 || (found && (pt->partno != pt->parts))) { - offmatrix[pt->partno - 1][0] %= (AC_DEFAULT_TRACKLEN + 1); - if(!offmatrix[pt->partno - 1][0]) - offmatrix[pt->partno - 1][0]++; + offmatrix[pt->partno - 1][0] %= AC_DEFAULT_TRACKLEN; + offmatrix[pt->partno - 1][0]++; - offmatrix[pt->partno - 1][offmatrix[pt->partno - 1][0]] = realoff + pt->length; - if(pt->partno) /* save realoff for the first part */ + offmatrix[pt->partno - 1][offmatrix[pt->partno - 1][0]] = realoff + pt->length + pt->prefix_length; + if(pt->partno == 1) /* save realoff for the first part */ offmatrix[pt->parts - 1][offmatrix[pt->partno - 1][0]] = realoff; } else if(found && pt->partno == pt->parts) { if(pt->type) {