From 43adde3e776012affe80277113ec921554148d46 Mon Sep 17 00:00:00 2001 From: Shawn Webb Date: Tue, 21 Jan 2014 14:32:09 -0500 Subject: [PATCH] Fix a couple bugs --- libclamav/matcher.c | 2 +- libclamav/pe.c | 30 +++++++++++++++++------------- libclamav/stats.c | 5 +++++ 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/libclamav/matcher.c b/libclamav/matcher.c index 20cd72c61..322cbb810 100644 --- a/libclamav/matcher.c +++ b/libclamav/matcher.c @@ -535,7 +535,7 @@ int cli_checkfp(unsigned char *digest, size_t size, cli_ctx *ctx) if(cli_hm_scan(shash1, 2, &virname, ctx->engine->hm_fp, CLI_HASH_SHA1) == CL_VIRUS) { cli_dbgmsg("cli_checkfp(pe): PE file whitelisted by catalog file\n"); - return CL_CLEAN; + return CL_CLEAN; } } } diff --git a/libclamav/pe.c b/libclamav/pe.c index 6852e02b1..d9066d814 100644 --- a/libclamav/pe.c +++ b/libclamav/pe.c @@ -3013,20 +3013,24 @@ int cli_checkfp_pe(cli_ctx *ctx, uint8_t *authsha1, stats_section_t *hashes, uin } free(exe_sections); - SHA1Final(&sha1, authsha1); - - if(cli_debug_flag) { - char shatxt[SHA1_HASH_SIZE*2+1]; - for(i=0; iengine), map, at + 8, hlen, authsha1); + return asn1_check_mscat((struct cl_engine *)(ctx->engine), map, at + 8, hlen, authsha1); + } else { + return CL_VIRUS; + } } diff --git a/libclamav/stats.c b/libclamav/stats.c index 0f9164f1f..189252db1 100644 --- a/libclamav/stats.c +++ b/libclamav/stats.c @@ -370,6 +370,11 @@ void clamav_stats_remove_sample(const char *virname, const unsigned char *md5, s if (sample == intel->samples) intel->samples = sample->next; + if ((sample->sections) && (sample->sections->nsections)) { + free(sample->sections->sections); + free(sample->sections); + } + free_sample(sample); intel->nsamples--; }