improve format scoring

git-svn: trunk@2649
remotes/push_mirror/metadata
Tomasz Kojm 19 years ago
parent 2dbcf7004a
commit 7f40f4fe65
  1. 4
      clamav-devel/ChangeLog
  2. 15
      clamav-devel/libclamav/cab.c

@ -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

@ -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;

Loading…
Cancel
Save