Browse code

fix incorrect calculation of maxshift in some cases (bb#390)

git-svn: trunk@2921

Tomasz Kojm authored on 2007/03/09 09:23:22
Showing 2 changed files
... ...
@@ -1,3 +1,8 @@
1
+Thu Mar  8 22:45:39 CET 2007 (tk)
2
+---------------------------------
3
+  * libclamav/matcher-ac.c: fix incorrect calculation of maxshift in some cases
4
+			    (bb#390)
5
+
1 6
 Thu Mar  8 20:34:36 EET 2007 (edwin)
2 7
 ---------------------------------
3 8
   * contrib/entitynorm/: fix entity list generator to support more entities,
... ...
@@ -480,7 +480,10 @@ int cli_ac_scanbuff(const unsigned char *buffer, unsigned int length, const char
480 480
 			    }
481 481
 
482 482
 			    if(found) {
483
-				mdata->maxshift[pt->sigid - 1] = mdata->partoff[pt->sigid - 1][j] + pt->maxdist - curroff;
483
+				if(pt->maxdist)
484
+				    mdata->maxshift[pt->sigid - 1] = mdata->partoff[pt->sigid - 1][j] + pt->maxdist - curroff;
485
+				else
486
+				    mdata->maxshift[pt->sigid - 1] = -1;
484 487
 
485 488
 				mdata->partoff[pt->sigid - 1][0] = curroff + pt->length;
486 489
 				mdata->offcnt[pt->sigid - 1] = 1;