bz#10978 fix for allmatch/unzip issue.

pull/6/head
Steven Morgan 11 years ago
parent b9bf2586a8
commit 92e0ae1504
  1. 8
      libclamav/unzip.c

@ -479,6 +479,7 @@ int cli_unzip(cli_ctx *ctx) {
fmap_t *map = *ctx->fmap; fmap_t *map = *ctx->fmap;
char *tmpd; char *tmpd;
const char *ptr; const char *ptr;
int virus_found = 0;
cli_dbgmsg("in cli_unzip\n"); cli_dbgmsg("in cli_unzip\n");
fsize = (uint32_t)map->len; fsize = (uint32_t)map->len;
@ -525,6 +526,10 @@ int cli_unzip(cli_ctx *ctx) {
while (ret==CL_CLEAN && lhoff<fsize && (coff=lhdr(map, lhoff, fsize-lhoff, &fu, fc+1, NULL, &ret, ctx, tmpd, 1))) { while (ret==CL_CLEAN && lhoff<fsize && (coff=lhdr(map, lhoff, fsize-lhoff, &fu, fc+1, NULL, &ret, ctx, tmpd, 1))) {
fc++; fc++;
lhoff+=coff; lhoff+=coff;
if (SCAN_ALL && ret == CL_VIRUS) {
ret = CL_CLEAN;
virus_found = 1;
}
if (ctx->engine->maxfiles && fu>=ctx->engine->maxfiles) { if (ctx->engine->maxfiles && fu>=ctx->engine->maxfiles) {
cli_dbgmsg("cli_unzip: Files limit reached (max: %u)\n", ctx->engine->maxfiles); cli_dbgmsg("cli_unzip: Files limit reached (max: %u)\n", ctx->engine->maxfiles);
ret=CL_EMAXFILES; ret=CL_EMAXFILES;
@ -535,6 +540,9 @@ int cli_unzip(cli_ctx *ctx) {
if (!ctx->engine->keeptmp) cli_rmdirs(tmpd); if (!ctx->engine->keeptmp) cli_rmdirs(tmpd);
free(tmpd); free(tmpd);
if (ret == CL_CLEAN && virus_found)
ret = CL_VIRUS;
return ret; return ret;
} }

Loading…
Cancel
Save