Browse code

libclamav/matcher-bm.c: fix offset check (bb#2032)

Tomasz Kojm authored on 2010/05/19 06:36:50
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Tue May 18 23:35:43 CEST 2010 (tk)
2
+----------------------------------
3
+ * libclamav/matcher-bm.c: fix offset check (bb#2032)
4
+
1 5
 Tue May 18 20:20:15 EEST 2010 (edwin)
2 6
 -------------------------------------
3 7
  * libclamav/fmap.c: fix bug introduced in clamav-0.96-51-g3e3b587.
... ...
@@ -271,6 +271,8 @@ int cli_bm_scanbuff(const unsigned char *buffer, uint32_t length, const char **v
271 271
     if(offdata) {
272 272
 	if(!offdata->cnt)
273 273
 	    return CL_CLEAN;
274
+	if(offdata->pos == offdata->cnt)
275
+	    offdata->pos--;
274 276
 	for(; offdata->pos && offdata->offtab[offdata->pos] > offset; offdata->pos--);
275 277
 	if(offdata->offtab[offdata->pos] < offset)
276 278
 	    offdata->pos++;