diff --git a/clamav-devel/ChangeLog b/clamav-devel/ChangeLog index 8e906f947..9c92ae483 100644 --- a/clamav-devel/ChangeLog +++ b/clamav-devel/ChangeLog @@ -1,3 +1,7 @@ +Mon Jan 29 16:17:53 CET 2007 (tk) +--------------------------------- + * libclamav/cab.c: improve format scoring + Sun Jan 28 21:20:05 CET 2007 (tk) --------------------------------- * libclamav: improve handling of RAR archives, thanks to Edwin diff --git a/clamav-devel/libclamav/cab.c b/clamav-devel/libclamav/cab.c index bbc99ddaf..6ed7e6743 100644 --- a/clamav-devel/libclamav/cab.c +++ b/clamav-devel/libclamav/cab.c @@ -366,6 +366,12 @@ int cab_open(int fd, off_t offset, struct cab_archive *cab) /* files */ for(i = 0; i < cab->nfiles; i++) { + if(bscore > 10) { + cab_free(cab); + cli_dbgmsg("CAB: bscore == %u, most likely a fake cabinet\n", bscore); + return CL_EFORMAT; + } + if(cli_readn(fd, &file_hdr, sizeof(file_hdr)) != sizeof(file_hdr)) { cli_errmsg("cab_open: Can't read file %u header\n", i); cab_free(cab); @@ -414,7 +420,9 @@ int cab_open(int fd, off_t offset, struct cab_archive *cab) /* folder index */ if(fidx < 0xfffd) { if(fidx > cab->nfolders) { - cli_warnmsg("cab_open: File %s is not associated with any folder\n", file->name); + if(bscore < 3) + cli_warnmsg("cab_open: File %s is not associated with any folder\n", file->name); + bscore++; free(file->name); free(file); continue; @@ -446,11 +454,6 @@ int cab_open(int fd, off_t offset, struct cab_archive *cab) lfile = file; - if(bscore > 10) { - cab_free(cab); - cli_dbgmsg("CAB: bscore == %u, most likely a fake cabinet\n", bscore); - return CL_EFORMAT; - } } return CL_SUCCESS;