git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@1457 77e5149b-7576-45b1-b177-96237e5ba77b
Tomasz Kojm authored on 2005/04/07 07:48:06... | ... |
@@ -1,3 +1,8 @@ |
1 |
+Thu Apr 7 00:46:14 CEST 2005 (tk) |
|
2 |
+---------------------------------- |
|
3 |
+ * libclamav/scanners.c: support ArchiveBlockMax in scan(g|b)zip() |
|
4 |
+ (reported by Rudolph Pereira <rudolph*usyd.edu.au>) |
|
5 |
+ |
|
1 | 6 |
Wed Apr 6 23:58:29 CEST 2005 (tk) |
2 | 7 |
---------------------------------- |
3 | 8 |
* clamd/scanner.c: fix possible crash when MaxStreamLength < FILEBUFF |
... | ... |
@@ -588,7 +588,10 @@ static int cli_scangzip(int desc, const char **virname, long int *scanned, const |
588 | 588 |
if(limits) |
589 | 589 |
if(limits->maxfilesize && (size + FILEBUFF > limits->maxfilesize)) { |
590 | 590 |
cli_dbgmsg("GZip: Size exceeded (stopped at %ld, max: %ld)\n", size, limits->maxfilesize); |
591 |
- /* ret = CL_EMAXSIZE; */ |
|
591 |
+ if(BLOCKMAX) { |
|
592 |
+ *virname = "GZip.ExceededFileSize"; |
|
593 |
+ ret = CL_VIRUS; |
|
594 |
+ } |
|
592 | 595 |
break; |
593 | 596 |
} |
594 | 597 |
|
... | ... |
@@ -603,6 +606,12 @@ static int cli_scangzip(int desc, const char **virname, long int *scanned, const |
603 | 603 |
|
604 | 604 |
free(buff); |
605 | 605 |
gzclose(gd); |
606 |
+ |
|
607 |
+ if(ret == CL_VIRUS) { |
|
608 |
+ fclose(tmp); |
|
609 |
+ return ret; |
|
610 |
+ } |
|
611 |
+ |
|
606 | 612 |
if(fsync(fd) == -1) { |
607 | 613 |
cli_dbgmsg("GZip: Can't synchronise descriptor %d\n", fd); |
608 | 614 |
fclose(tmp); |
... | ... |
@@ -676,7 +685,10 @@ static int cli_scanbzip(int desc, const char **virname, long int *scanned, const |
676 | 676 |
if(limits) |
677 | 677 |
if(limits->maxfilesize && (size + FILEBUFF > limits->maxfilesize)) { |
678 | 678 |
cli_dbgmsg("Bzip: Size exceeded (stopped at %ld, max: %ld)\n", size, limits->maxfilesize); |
679 |
- /* ret = CL_EMAXSIZE; */ |
|
679 |
+ if(BLOCKMAX) { |
|
680 |
+ *virname = "BZip.ExceededFileSize"; |
|
681 |
+ ret = CL_VIRUS; |
|
682 |
+ } |
|
680 | 683 |
break; |
681 | 684 |
} |
682 | 685 |
|
... | ... |
@@ -692,6 +704,13 @@ static int cli_scanbzip(int desc, const char **virname, long int *scanned, const |
692 | 692 |
|
693 | 693 |
free(buff); |
694 | 694 |
BZ2_bzReadClose(&bzerror, bfd); |
695 |
+ |
|
696 |
+ if(ret == CL_VIRUS) { |
|
697 |
+ fclose(tmp); |
|
698 |
+ fclose(fs); |
|
699 |
+ return ret; |
|
700 |
+ } |
|
701 |
+ |
|
695 | 702 |
if(fsync(fd) == -1) { |
696 | 703 |
cli_dbgmsg("Bzip: Synchronisation failed for descriptor %d\n", fd); |
697 | 704 |
fclose(tmp); |