pass duplicated descriptor to cabd->dsearch()

git-svn: trunk@1098
remotes/push_mirror/metadata
Tomasz Kojm 21 years ago
parent df8806fd46
commit 0c9d7f155f
  1. 4
      clamav-devel/ChangeLog
  2. 14
      clamav-devel/libclamav/matcher.c
  3. 9
      clamav-devel/libclamav/scanners.c

@ -1,3 +1,7 @@
Mon Nov 15 23:55:50 CET 2004 (tk)
---------------------------------
* libclamav/scanners.c: mscab: pass duplicated descriptor to cabd->dsearch()
Sun Nov 14 15:23:02 GMT 2004 (njh)
----------------------------------
* clamav-milter: Use SCAN in more places in preference to STREAM

@ -41,6 +41,7 @@
#define TARGET_TABLE_SIZE 6
static int targettab[TARGET_TABLE_SIZE] = { 0, CL_TYPE_MSEXE, CL_TYPE_MSOLE2, CL_TYPE_HTML, CL_TYPE_MAIL, CL_TYPE_GRAPHICS };
extern short cli_debug_flag;
int cli_scanbuff(const char *buffer, unsigned int length, const char **virname, const struct cl_node *root, unsigned short ftype)
{
@ -283,6 +284,19 @@ int cli_scandesc(int desc, const char **virname, long int *scanned, const struct
if(root->md5_hlist) {
MD5Final(digest, &ctx);
if(cli_debug_flag) {
char md5str[33];
int i;
pt = md5str;
for(i = 0; i < 16; i++) {
sprintf(pt, "%02x", digest[i]);
pt += 2;
}
md5str[32] = 0;
cli_dbgmsg("Calculated MD5 checksum: %s\n", md5str);
}
if((md5_node = cli_vermd5(digest, root))) {
struct stat sb;

@ -321,10 +321,12 @@ static int cli_scanzip(int desc, const char **virname, long int *scanned, const
cli_dbgmsg("Zip: %s, compressed: %u, normal: %u, ratio: %d (max: %d)\n", zdirent.d_name, zdirent.d_csize, zdirent.st_size, zdirent.st_size / (zdirent.d_csize+1), limits ? limits->maxratio : -1 );
if(!zdirent.st_size) { /* omit directories and empty files */
/*
if(!zdirent.st_size) {
files++;
continue;
}
*/
/* work-around for problematic zips (zziplib crashes with them) */
if(zdirent.d_csize <= 0 || zdirent.st_size < 0) {
@ -666,7 +668,7 @@ static int cli_scanmscab(int desc, const char **virname, long int *scanned, cons
return CL_EMSCAB;
}
if((base = cabd->dsearch(cabd, desc)) == NULL) {
if((base = cabd->dsearch(cabd, dup(desc))) == NULL) {
cli_dbgmsg("MSCAB: I/O error or no valid cabinets found\n");
mspack_destroy_cab_decompressor(cabd);
return CL_EMSCAB;
@ -1307,7 +1309,8 @@ int cli_magic_scandesc(int desc, const char **virname, long int *scanned, const
int typerec;
type == CL_TYPE_UNKNOWN_TEXT ? (typerec = 1) : (typerec = 0);
lseek(desc, 0, SEEK_SET);
if(lseek(desc, 0, SEEK_SET) < 0)
cli_errmsg("lseek() failed, trying to continue anyway...\n");
if((nret = cli_scandesc(desc, virname, scanned, root, typerec, type)) == CL_VIRUS) {
cli_dbgmsg("%s found in descriptor %d.\n", *virname, desc);

Loading…
Cancel
Save