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
... ...
@@ -2394,8 +2394,10 @@ static int magic_scandesc(int desc, cli_ctx *ctx, cli_file_t type)
2394 2394
 		    cli_dbgmsg("Descriptor[%d]: Continuing after cli_scanraw reached %s\n",
2395 2395
 			desc, cl_strerror(res));
2396 2396
 		    break;
2397
-		/* Other errors must not block further scans below */
2398
-		/* This specifically includes CL_EFORMAT & CL_EREAD */
2397
+		/* Other errors must not block further scans below
2398
+		 * This specifically includes CL_EFORMAT & CL_EREAD & CL_EUNPACK
2399
+		 * Malformed/truncated files could report as any of these three.
2400
+		 */
2399 2401
 		default:
2400 2402
 		    ret = res;
2401 2403
 		    cli_dbgmsg("Descriptor[%d]: Continuing after cli_scanraw error %s\n",
... ...
@@ -2443,11 +2445,16 @@ static int magic_scandesc(int desc, cli_ctx *ctx, cli_file_t type)
2443 2443
     ctx->hook_lsig_matches = old_hook_lsig_matches;
2444 2444
 
2445 2445
     switch(ret) {
2446
+	/* Malformed file cases */
2446 2447
 	case CL_EFORMAT:
2448
+	case CL_EREAD:
2449
+	case CL_EUNPACK:
2450
+	/* Limits exceeded */
2447 2451
 	case CL_EMAXREC:
2448 2452
 	case CL_EMAXSIZE:
2449 2453
 	case CL_EMAXFILES:
2450 2454
 	    cli_dbgmsg("Descriptor[%d]: %s\n", desc, cl_strerror(ret));
2455
+	    ret_from_magicscan(CL_CLEAN);
2451 2456
 	case CL_CLEAN:
2452 2457
 	    cache_add(hash, hashed_size, ctx);
2453 2458
 	    ret_from_magicscan(CL_CLEAN);