... | ... |
@@ -1,3 +1,8 @@ |
1 |
+Wed Dec 16 15:33:01 CET 2009 (acab) |
|
2 |
+----------------------------------- |
|
3 |
+ * libclamav/unzip.c: do not mark embedded zipfiles as |
|
4 |
+ encrypted.zip (bb#1768) |
|
5 |
+ |
|
1 | 6 |
Wed Dec 16 15:22:28 CET 2009 (acab) |
2 | 7 |
----------------------------------- |
3 | 8 |
* clamd/server-th.c: remove c++ comment (bb#1751) |
... | ... |
@@ -297,7 +297,7 @@ static int unz(uint8_t *src, uint32_t csize, uint32_t usize, uint16_t method, ui |
297 | 297 |
return ret; |
298 | 298 |
} |
299 | 299 |
|
300 |
-static unsigned int lhdr(fmap_t *map, uint32_t loff,uint32_t zsize, unsigned int *fu, unsigned int fc, uint8_t *ch, int *ret, cli_ctx *ctx, char *tmpd) { |
|
300 |
+static unsigned int lhdr(fmap_t *map, uint32_t loff,uint32_t zsize, unsigned int *fu, unsigned int fc, uint8_t *ch, int *ret, cli_ctx *ctx, char *tmpd, int detect_encrypted) { |
|
301 | 301 |
uint8_t *lh, *zip; |
302 | 302 |
char name[256]; |
303 | 303 |
uint32_t csize, usize; |
... | ... |
@@ -362,7 +362,7 @@ static unsigned int lhdr(fmap_t *map, uint32_t loff,uint32_t zsize, unsigned int |
362 | 362 |
return 0; |
363 | 363 |
} |
364 | 364 |
|
365 |
- if((LH_flags & F_ENCR) && DETECT_ENCRYPTED) { |
|
365 |
+ if(detect_encrypted && (LH_flags & F_ENCR) && DETECT_ENCRYPTED) { |
|
366 | 366 |
cli_dbgmsg("cli_unzip: Encrypted files found in archive.\n"); |
367 | 367 |
*ctx->virname = "Encrypted.Zip"; |
368 | 368 |
*ret = CL_VIRUS; |
... | ... |
@@ -469,7 +469,7 @@ static unsigned int chdr(fmap_t *map, uint32_t coff, uint32_t zsize, unsigned in |
469 | 469 |
coff+=CH_clen; |
470 | 470 |
|
471 | 471 |
if(CH_off<zsize-SIZEOF_LH) { |
472 |
- lhdr(map, CH_off, zsize-CH_off, fu, fc, ch, ret, ctx, tmpd); |
|
472 |
+ lhdr(map, CH_off, zsize-CH_off, fu, fc, ch, ret, ctx, tmpd, 1); |
|
473 | 473 |
} else cli_dbgmsg("cli_unzip: ch - local hdr out of file\n"); |
474 | 474 |
fmap_unneed_ptr(map, ch, SIZEOF_CH); |
475 | 475 |
return last?0:coff; |
... | ... |
@@ -525,7 +525,7 @@ int cli_unzip(cli_ctx *ctx) { |
525 | 525 |
} else cli_dbgmsg("cli_unzip: central not found, using localhdrs\n"); |
526 | 526 |
if(fu<=(fc/4)) { /* FIXME: make up a sane ratio or remove the whole logic */ |
527 | 527 |
fc = 0; |
528 |
- while (ret==CL_CLEAN && lhoff<fsize && (coff=lhdr(map, lhoff, fsize-lhoff, &fu, fc+1, NULL, &ret, ctx, tmpd))) { |
|
528 |
+ while (ret==CL_CLEAN && lhoff<fsize && (coff=lhdr(map, lhoff, fsize-lhoff, &fu, fc+1, NULL, &ret, ctx, tmpd, 1))) { |
|
529 | 529 |
fc++; |
530 | 530 |
lhoff+=coff; |
531 | 531 |
if (ctx->engine->maxfiles && fu>=ctx->engine->maxfiles) { |
... | ... |
@@ -558,7 +558,7 @@ int cli_unzip_single(cli_ctx *ctx, off_t lhoffl) { |
558 | 558 |
return CL_CLEAN; |
559 | 559 |
} |
560 | 560 |
|
561 |
- lhdr(map, lhoffl, fsize, &fu, 0, NULL, &ret, ctx, NULL); |
|
561 |
+ lhdr(map, lhoffl, fsize, &fu, 0, NULL, &ret, ctx, NULL, 0); |
|
562 | 562 |
|
563 | 563 |
return ret; |
564 | 564 |
} |