limits in scanbuff

git-svn: trunk@3618
remotes/push_mirror/metadata
aCaB 18 years ago
parent 41273d0802
commit 2ac2095aa5
  1. 4
      ChangeLog
  2. 9
      libclamav/matcher.c
  3. 2
      libclamav/matcher.h
  4. 2
      libclamav/mbox.c
  5. 6
      libclamav/scanners.c

@ -1,3 +1,7 @@
Mon Feb 11 22:16:10 CET 2008 (acab)
-----------------------------------
* libclamav: account for scanned data in cli_scanbuff too
Mon Feb 11 21:04:30 CET 2008 (acab)
-----------------------------------
* libclamav: more limit updates, more to come

@ -46,21 +46,22 @@
#include "cltypes.h"
int cli_scanbuff(const unsigned char *buffer, uint32_t length, const char **virname, const struct cl_engine *engine, cli_file_t ftype)
int cli_scanbuff(const unsigned char *buffer, uint32_t length, cli_ctx *ctx, cli_file_t ftype)
{
int ret = CL_CLEAN;
unsigned int i;
struct cli_ac_data mdata;
struct cli_matcher *groot, *troot = NULL;
const char **virname=ctx->virname;
const struct cl_engine *engine=ctx->engine;
if(!engine) {
cli_errmsg("cli_scanbuff: engine == NULL\n");
return CL_ENULLARG;
}
/* FIXMELIMITS need cts to account limits */
/* if(cli_updatelimits(ctx, length)!=CL_CLEAN) */
/* return CL_CLEAN; */
if(cli_updatelimits(ctx, length)!=CL_CLEAN)
return CL_CLEAN;
groot = engine->root[0]; /* generic signatures */

@ -92,7 +92,7 @@ struct cli_target_info {
int8_t status; /* 0 == not initialised, 1 == initialised OK, -1 == error */
};
int cli_scanbuff(const unsigned char *buffer, uint32_t length, const char **virname, const struct cl_engine *engine, cli_file_t ftype);
int cli_scanbuff(const unsigned char *buffer, uint32_t length, cli_ctx *ctx, cli_file_t ftype);
int cli_scandesc(int desc, cli_ctx *ctx, uint8_t otfrec, cli_file_t ftype, uint8_t ftonly, struct cli_matched_type **ftoffset);

@ -1050,7 +1050,7 @@ save_text(cli_ctx *ctx, const char *dir, const char *start, size_t len)
* in this way. It gets the "filetype" wrong and then
* doesn't scan correctly
*/
if(cli_scanbuff((char *)p, len, ctx->virname, ctx->engine, CL_TYPE_BINARY_DATA) == CL_VIRUS) {
if(cli_scanbuff((char *)p, len, ctx, CL_TYPE_BINARY_DATA) == CL_VIRUS) {
cli_dbgmsg("save_text: found %s\n", *ctx->virname);
return CL_VIRUS;
}

@ -749,7 +749,7 @@ static int cli_vba_scandir(const char *dirname, cli_ctx *ctx)
if(ctx->scanned)
*ctx->scanned += data_len / CL_COUNT_PRECISION;
if(cli_scanbuff(data, data_len, ctx->virname, ctx->engine, CL_TYPE_MSOLE2) == CL_VIRUS) {
if(cli_scanbuff(data, data_len, ctx, CL_TYPE_MSOLE2) == CL_VIRUS) {
free(data);
ret = CL_VIRUS;
break;
@ -797,7 +797,7 @@ static int cli_vba_scandir(const char *dirname, cli_ctx *ctx)
} else {
if(ctx->scanned)
*ctx->scanned += vba_project->length[i] / CL_COUNT_PRECISION;
if(cli_scanbuff(data, vba_project->length[i], ctx->virname, ctx->engine, CL_TYPE_MSOLE2) == CL_VIRUS) {
if(cli_scanbuff(data, vba_project->length[i], ctx, CL_TYPE_MSOLE2) == CL_VIRUS) {
free(data);
ret = CL_VIRUS;
break;
@ -1019,7 +1019,7 @@ static int cli_scanscript(int desc, cli_ctx *ctx)
/* we can continue to scan in memory */
}
/* when we flush the buffer also scan */
if(cli_scanbuff(state.out, state.out_pos, ctx->virname, ctx->engine, CL_TYPE_TEXT_ASCII) == CL_VIRUS) {
if(cli_scanbuff(state.out, state.out_pos, ctx, CL_TYPE_TEXT_ASCII) == CL_VIRUS) {
ret = CL_VIRUS;
break;
}

Loading…
Cancel
Save