Browse code

bb11547 - print all CDBNAME entries for a zip file when using the -z flag.

Steven Morgan authored on 2016/03/30 05:18:51
Showing 1 changed files
... ...
@@ -730,7 +730,7 @@ int cli_unzip(cli_ctx *ctx) {
730 730
 
731 731
   if(coff) {
732 732
       cli_dbgmsg("cli_unzip: central @%x\n", coff);
733
-      while(ret==CL_CLEAN && (coff=chdr(map, coff, fsize, &fu, fc+1, &ret, ctx, tmpd, NULL))) {
733
+      while((coff=chdr(map, coff, fsize, &fu, fc+1, &ret, ctx, tmpd, NULL))) {
734 734
 	  fc++;
735 735
 	  if (ctx->engine->maxfiles && fu>=ctx->engine->maxfiles) {
736 736
 	      cli_dbgmsg("cli_unzip: Files limit reached (max: %u)\n", ctx->engine->maxfiles);
... ...
@@ -741,9 +741,17 @@ int cli_unzip(cli_ctx *ctx) {
741 741
               ret=CL_ETIMEOUT;
742 742
           }
743 743
 #endif
744
-
744
+          if (ret != CL_CLEAN) {
745
+              if (ret == CL_VIRUS && SCAN_ALL) {
746
+                  ret = CL_CLEAN;
747
+                  virus_found = 1;
748
+              } else
749
+                  break;
750
+          }
745 751
       }
746 752
   } else cli_dbgmsg("cli_unzip: central not found, using localhdrs\n");
753
+  if (virus_found == 1)
754
+      ret = CL_VIRUS;
747 755
   if(fu<=(fc/4)) { /* FIXME: make up a sane ratio or remove the whole logic */
748 756
     fc = 0;
749 757
     while (ret==CL_CLEAN && lhoff<fsize && (coff=lhdr(map, lhoff, fsize-lhoff, &fu, fc+1, NULL, &ret, ctx, tmpd, 1, zip_scan_cb))) {