Index: shared/cfgparser.c =================================================================== --- shared/cfgparser.c (.../vendor/clamav/0.91.1) (revision 39233) +++ shared/cfgparser.c (.../trunk/clamav) (revision 39233) @@ -61,6 +61,7 @@ {"ScanPDF", OPT_BOOL, 0, NULL, 0, OPT_CLAMD}, {"ScanArchive", OPT_BOOL, 1, NULL, 0, OPT_CLAMD}, {"ArchiveMaxFileSize", OPT_COMPSIZE, 10485760, NULL, 0, OPT_CLAMD}, + {"MaxFileSize", OPT_COMPSIZE, 0, NULL, 0, OPT_CLAMD}, {"ArchiveMaxRecursion", OPT_NUM, 8, NULL, 0, OPT_CLAMD}, {"ArchiveMaxFiles", OPT_NUM, 1000, NULL, 0, OPT_CLAMD}, {"ArchiveMaxCompressionRatio", OPT_NUM, 250, NULL, 0, OPT_CLAMD}, Index: clamd/server-th.c =================================================================== --- clamd/server-th.c (.../vendor/clamav/0.91.1) (revision 39233) +++ clamd/server-th.c (.../trunk/clamav) (revision 39233) @@ -325,6 +325,12 @@ logg("^Archive: Recursion level limit protection disabled.\n"); } + if((limits.maxscansize = cfgopt(copt, "MaxFileSize")->numarg)) { + logg("FileSize: Maximum scanned filesize set to %d.\n", limits.maxscansize); + } else { + logg("^FileSize: Maximum scanned filesize limit disabled.\n"); + } + if((limits.maxfiles = cfgopt(copt, "ArchiveMaxFiles")->numarg)) { logg("Archive: Files limit set to %u.\n", limits.maxfiles); } else { Index: libclamav/scanners.c =================================================================== --- libclamav/scanners.c (.../vendor/clamav/0.91.1) (revision 39233) +++ libclamav/scanners.c (.../trunk/clamav) (revision 39233) @@ -1873,6 +1873,10 @@ cli_dbgmsg("Small data (%u bytes)\n", (unsigned int) sb.st_size); return CL_CLEAN; } + if( (ctx->limits && ctx->limits->maxscansize) && sb.st_size > (uint32_t)ctx->limits->maxscansize ) { + cli_dbgmsg("Large data (%d bytes - limit set at %d )\n", sb.st_size); + return CL_CLEAN; + } if(!ctx->engine) { cli_errmsg("CRITICAL: engine == NULL\n"); Index: libclamav/clamav.h =================================================================== --- libclamav/clamav.h (.../vendor/clamav/0.91.1) (revision 39233) +++ libclamav/clamav.h (.../trunk/clamav) (revision 39233) @@ -167,6 +167,9 @@ unsigned long int maxfilesize; /* compressed files larger than this limit * will not be scanned */ + unsigned long int maxscansize; /* dk: files larger than this size + * will not be scanned + */ }; struct cl_stat {