diff --git a/ChangeLog b/ChangeLog index 2d970da0f..019f6565b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Mar 5 21:14:12 CET 2010 (tk) +--------------------------------- + * libclamav/matcher-bm.c: properly handle scan boundaries in + offset mode (bb#1840) + Fri Mar 5 19:11:25 CET 2010 (tk) --------------------------------- * libclamav: fix cl_cvdparse() leak (bb#1859) diff --git a/libclamav/matcher-bm.c b/libclamav/matcher-bm.c index 6c445dfaf..4faa4492b 100644 --- a/libclamav/matcher-bm.c +++ b/libclamav/matcher-bm.c @@ -269,7 +269,10 @@ int cli_bm_scanbuff(const unsigned char *buffer, uint32_t length, const char **v memset(&info, 0, sizeof(info)); i = BM_MIN_LENGTH - BM_BLOCK_SIZE; if(offdata) { - if(offdata->pos == offdata->cnt) + for(; offdata->pos && offdata->offtab[offdata->pos] > offset; offdata->pos--); + if(offdata->offtab[offdata->pos] < offset) + offdata->pos++; + if(offdata->pos >= offdata->cnt) return CL_CLEAN; i += offdata->offtab[offdata->pos] - offset; }