Reset virname after iconscan API called from bytecode.

0.96
Török Edvin 15 years ago
parent a8935f90b9
commit 7882e72107
  1. 11
      libclamav/matcher.c

@ -452,8 +452,11 @@ static int matchicon(cli_ctx *ctx, struct cli_exe_info *exeinfo, const char *grp
int32_t cli_bcapi_matchicon(struct cli_bc_ctx *ctx , const uint8_t* grp1, int32_t grp1len,
const uint8_t* grp2, int32_t grp2len)
{
struct cli_exe_info info;
int ret;
char group1[128], group2[128];
const char *oldvirname;
struct cli_exe_info info;
if (ctx->bc->kind != BC_PE_UNPACKER) {
cli_dbgmsg("bytecode: matchicon only works with PE files\n");
return -1;
@ -461,10 +464,12 @@ int32_t cli_bcapi_matchicon(struct cli_bc_ctx *ctx , const uint8_t* grp1, int32_
if (grp1len > sizeof(group1)-1 ||
grp2len > sizeof(group2)-1)
return -1;
oldvirname = ctx->ctx->virname;
memcpy(group1, grp1, grp1len);
memcpy(group2, grp2, grp2len);
group1[grp1len] = 0;
group2[grp1len] = 0;
memset(&info, 0, sizeof(info));
if(le16_to_host(ctx->hooks.pedata->file_hdr.Characteristics) & 0x2000 ||
!ctx->hooks.pedata->dirs[2].Size)
info.res_addr = 0;
@ -473,7 +478,9 @@ int32_t cli_bcapi_matchicon(struct cli_bc_ctx *ctx , const uint8_t* grp1, int32_
info.section = (struct cli_exe_section*)ctx->sections;
info.nsections = ctx->hooks.pedata->nsections;
info.hdr_size = ctx->hooks.pedata->hdr_size;
return matchicon(ctx->ctx, &info, group1, group2);
ret = matchicon(ctx->ctx, &info, group1, group2);
ctx->ctx->virname = oldvirname;
return ret;
}

Loading…
Cancel
Save