Browse code

respect file size limit in cli_scanmscab()

git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@963 77e5149b-7576-45b1-b177-96237e5ba77b

Tomasz Kojm authored on 2004/10/04 10:15:12
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Mon Oct  4 03:09:46 CEST 2004 (tk)
2
+----------------------------------
3
+  * libclamav/scanners.c: respect file size limit in cli_scanmscab()
4
+
1 5
 Sun Oct  3 17:04:27 CEST 2004 (tk)
2 6
 ----------------------------------
3 7
   * libclamav, clamd: use readdir_r when available
... ...
@@ -656,6 +656,18 @@ static int cli_scanmscab(int desc, const char **virname, long int *scanned, cons
656 656
 
657 657
     for(cab = base; cab; cab = cab->next) {
658 658
 	for(file = cab->files; file; file = file->next) {
659
+
660
+	    if(limits && limits->maxfilesize && (file->length > (unsigned int) limits->maxfilesize)) {
661
+		cli_dbgmsg("MSCAB: %s: Size exceeded (%u, max: %lu)\n", file->filename, file->length, limits->maxfilesize);
662
+		if(BLOCKMAX) {
663
+		    *virname = "MSCAB.ExceededFileSize";
664
+		    cabd->close(cabd, base);
665
+		    mspack_destroy_cab_decompressor(cabd);
666
+		    return CL_VIRUS;
667
+		}
668
+		continue;
669
+	    }
670
+
659 671
 	    tempname = cli_gentemp(tmpdir);
660 672
 	    cli_dbgmsg("MSCAB: Extracting data to %s\n", tempname);
661 673
 	    if(cabd->extract(cabd, file, tempname)) {