Browse code

Add CL_EUNPACK and caching tweak for bb#5252

David Raynor authored on 2012/07/02 23:40:50
Showing 1 changed files
... ...
@@ -2566,8 +2566,10 @@ static int magic_scandesc(cli_ctx *ctx, cli_file_t type)
2566 2566
 		    cli_dbgmsg("Descriptor[%d]: Continuing after cli_scanraw reached %s\n",
2567 2567
 			fmap_fd(*ctx->fmap), cl_strerror(res));
2568 2568
 		    break;
2569
-		/* Other errors must not block further scans below */
2570
-		/* This specifically includes CL_EFORMAT & CL_EREAD */
2569
+		/* Other errors must not block further scans below
2570
+		 * This specifically includes CL_EFORMAT & CL_EREAD & CL_EUNPACK
2571
+		 * Malformed/truncated files could report as any of these three.
2572
+		 */
2571 2573
 		default:
2572 2574
 		    ret = res;
2573 2575
 		    cli_dbgmsg("Descriptor[%d]: Continuing after cli_scanraw error %s\n",
... ...
@@ -2615,11 +2617,16 @@ static int magic_scandesc(cli_ctx *ctx, cli_file_t type)
2615 2615
     ctx->hook_lsig_matches = old_hook_lsig_matches;
2616 2616
 
2617 2617
     switch(ret) {
2618
+	/* Malformed file cases */
2618 2619
 	case CL_EFORMAT:
2620
+	case CL_EREAD:
2621
+	case CL_EUNPACK:
2622
+	/* Limits exceeded */
2619 2623
 	case CL_EMAXREC:
2620 2624
 	case CL_EMAXSIZE:
2621 2625
 	case CL_EMAXFILES:
2622 2626
 	    cli_dbgmsg("Descriptor[%d]: %s\n", fmap_fd(*ctx->fmap), cl_strerror(ret));
2627
+	    ret_from_magicscan(CL_CLEAN);
2623 2628
 	case CL_CLEAN:
2624 2629
 	    cache_clean = 1;
2625 2630
 	    ret_from_magicscan(CL_CLEAN);