From 661e8e3f5a6b56901e645cb5ed0c2de67ade7127 Mon Sep 17 00:00:00 2001 From: Tomasz Kojm Date: Wed, 25 Aug 2010 14:45:19 +0200 Subject: [PATCH] minor code cleanup --- libclamav/matcher-ac.c | 2 +- libclamav/matcher.c | 7 ++----- libclamav/scanners.c | 11 ----------- 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/libclamav/matcher-ac.c b/libclamav/matcher-ac.c index b6602576c..53cdbfc74 100644 --- a/libclamav/matcher-ac.c +++ b/libclamav/matcher-ac.c @@ -1232,8 +1232,8 @@ int cli_ac_scanbuff(const unsigned char *buffer, uint32_t length, const char **v } offmatrix = mdata->offmatrix[pt->sigid - 1]; + found = 0; if(pt->partno != 1) { - found = 0; for(j = 1; j <= CLI_DEFAULT_AC_TRACKLEN + 1 && offmatrix[pt->partno - 2][j] != -1; j++) { found = j; if(pt->maxdist) diff --git a/libclamav/matcher.c b/libclamav/matcher.c index 7d1ee848b..c62cd3d78 100644 --- a/libclamav/matcher.c +++ b/libclamav/matcher.c @@ -381,8 +381,6 @@ int cli_checkfp(unsigned char *digest, size_t size, cli_ctx *ctx) char md5[33]; unsigned int i; const char *virname; - const struct cli_md5m_patt *patt = NULL; - if(ctx->engine->md5_fp && cli_md5m_scan(digest, size, &virname, ctx->engine->md5_fp) == CL_VIRUS) { cli_dbgmsg("cli_checkfp(): Found false positive detection (fp sig: %s)\n", virname); @@ -462,8 +460,8 @@ int32_t cli_bcapi_matchicon(struct cli_bc_ctx *ctx , const uint8_t* grp1, int32_ cli_dbgmsg("bytecode: matchicon only works with PE files\n"); return -1; } - if (grp1len > sizeof(group1)-1 || - grp2len > sizeof(group2)-1) + if ((size_t) grp1len > sizeof(group1)-1 || + (size_t) grp2len > sizeof(group2)-1) return -1; oldvirname = ((cli_ctx*)ctx->ctx)->virname; ((cli_ctx*)ctx->ctx)->virname = NULL; @@ -711,7 +709,6 @@ int cli_fmap_scandesc(cli_ctx *ctx, cli_file_t ftype, uint8_t ftonly, struct cli return CL_VIRUS; if(!ftonly && ctx->engine->md5_hdb) { - const struct cli_md5m_patt *patt; if(!refhash) { cli_md5_final(digest, &md5ctx); refhash = digest; diff --git a/libclamav/scanners.c b/libclamav/scanners.c index ceffb261a..b65d7fff2 100644 --- a/libclamav/scanners.c +++ b/libclamav/scanners.c @@ -1735,17 +1735,6 @@ static int cli_scanraw(cli_ctx *ctx, cli_file_t type, uint8_t typercg, cli_file_ if(ret >= CL_TYPENO) { ctx->recursion++; - -/* - if(type == CL_TYPE_TEXT_ASCII) { - lseek(desc, 0, SEEK_SET); - - nret = cli_scandesc(desc, ctx, 0, ret, 1, NULL); - if(nret == CL_VIRUS) - cli_dbgmsg("%s found in descriptor %d when scanning file type %u\n", *ctx->virname, desc, ret); - } -*/ - if(nret != CL_VIRUS) { lastzip = lastrar = 0xdeadbeef; fpt = ftoffset;