Browse code

bb 11127, add extra deference when using clamscan -a -z.

Steven Morgan authored on 2014/10/02 04:45:06
Showing 1 changed files
... ...
@@ -331,6 +331,10 @@ static void scanfile(const char *filename, struct cl_engine *engine, const struc
331 331
 
332 332
 
333 333
     if((ret = cl_scandesc_callback(fd, virpp, &info.blocks, engine, options, &chain)) == CL_VIRUS) {
334
+        if (options & CL_SCAN_ALLMATCHES) {
335
+            virpp = (const char **)*virpp; /* allmatch needs an extra dereference */
336
+            virname = virpp[0]; /* this is the first virus */
337
+        }
334 338
         if(optget(opts, "archive-verbose")->enabled) {
335 339
             if (chain.n > 1) {
336 340
                 char str[128];
... ...
@@ -344,9 +348,6 @@ static void scanfile(const char *filename, struct cl_engine *engine, const struc
344 344
 
345 345
         if (options & CL_SCAN_ALLMATCHES) {
346 346
             int i = 0;
347
-
348
-            virpp = (const char **)*virpp; /* horrible */
349
-            virname = virpp[0];
350 347
             while (virpp[i])
351 348
                 logg("~%s: %s FOUND\n", filename, virpp[i++]);
352 349