Browse code

don't cache negatives at ctx->maxXXXX

aCaB authored on 2010/03/05 07:48:16
Showing 1 changed files
... ...
@@ -1931,11 +1931,10 @@ int cli_magic_scandesc(int desc, cli_ctx *ctx)
1931 1931
 
1932 1932
 	if((ret = cli_fmap_scandesc(ctx, 0, 0, NULL, AC_SCAN_VIR, hash)) == CL_VIRUS)
1933 1933
 	    cli_dbgmsg("%s found in descriptor %d\n", *ctx->virname, desc);
1934
-	else
1935
-	    cache_add(hash, hashed_size, ctx);
1936
-
1934
+	else if(ctx->recursion != ctx->engine->maxreclevel)
1935
+	    cache_add(hash, hashed_size, ctx); /* Only cache if limits are not reached */                                                  
1937 1936
 	funmap(*ctx->fmap);
1938
-	ctx->fmap--; 
1937
+	ctx->fmap--;
1939 1938
 	return ret;
1940 1939
     }
1941 1940