only enable signature file type recognition for text files

git-svn: trunk@788
remotes/push_mirror/metadata
Tomasz Kojm 21 years ago
parent 7b304deeb2
commit 216a697f43
  1. 4
      clamav-devel/ChangeLog
  2. 16
      clamav-devel/libclamav/filetypes.c
  3. 3
      clamav-devel/libclamav/filetypes.h
  4. 9
      clamav-devel/libclamav/scanners.c

@ -1,3 +1,7 @@
Tue Aug 24 02:30:28 CEST 2004 (tk)
----------------------------------
* libclamav: only enable signature file type recognition for text files
Mon Aug 23 22:32:02 CEST 2004 (tk)
----------------------------------
* include database info in version string (requested by Jason Haar

@ -24,6 +24,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include "clamav.h"
#include "filetypes.h"
@ -110,7 +111,7 @@ static const struct cli_magic_s cli_magic[] = {
{0, "\060\046\262\165\216\146\317", 7, "WMA/WMV/ASF", CL_DATAFILE},
{0, ".RMF" , 4, "Real Media File", CL_DATAFILE},
{-1, NULL, 0, NULL, CL_UNKNOWN_TYPE}
{-1, NULL, 0, NULL, CL_UNKNOWN_DATA_TYPE}
};
static const struct cli_smagic_s cli_smagic[] = {
@ -136,12 +137,13 @@ static const struct cli_smagic_s cli_smagic[] = {
{"3c536372697074", "HTML data", CL_HTMLFILE}, /* <Script */
{"3c534352495054", "HTML data", CL_HTMLFILE}, /* <SCRIPT */
{NULL, NULL, CL_UNKNOWN_TYPE}
{NULL, NULL, CL_UNKNOWN_DATA_TYPE}
};
cli_file_t cli_filetype(const char *buf, size_t buflen)
{
int i;
int i, ascii = 1;
for(i = 0; cli_magic[i].magic; i++) {
if(buflen >= cli_magic[i].offset+cli_magic[i].length) {
@ -152,7 +154,13 @@ cli_file_t cli_filetype(const char *buf, size_t buflen)
}
}
return CL_UNKNOWN_TYPE;
for(i = 0; i < buflen; i++)
if(isprint(buf[i])) { /* FIXME: do we need to handle intern. chars? */
ascii = 0;
break;
}
return ascii ? CL_UNKNOWN_TEXT_TYPE : CL_UNKNOWN_DATA_TYPE;
}
int cli_addtypesigs(struct cl_node *root)

@ -24,7 +24,8 @@
#define CL_TYPENO 500
typedef enum {
CL_UNKNOWN_TYPE = CL_TYPENO,
CL_UNKNOWN_TEXT_TYPE = CL_TYPENO,
CL_UNKNOWN_DATA_TYPE,
CL_DOSEXE,
CL_DATAFILE,
CL_GZFILE,

@ -1125,12 +1125,15 @@ int cli_magic_scandesc(int desc, const char **virname, long int *scanned, const
{
struct stat s;
if(fstat(desc, &s) == 0 && S_ISREG(s.st_mode) && s.st_size < 65536)
type = CL_UNKNOWN_TYPE;
type = CL_UNKNOWN_DATA_TYPE;
}
default:
case CL_UNKNOWN_DATA_TYPE:
ret = cli_scan_mydoom_log(desc, virname, scanned, root, limits, options, arec, mrec);
break;
default:
break;
}
type == CL_MAILFILE ? (*mrec)-- : (*arec)--;
@ -1138,7 +1141,7 @@ int cli_magic_scandesc(int desc, const char **virname, long int *scanned, const
if(type != CL_DATAFILE && ret != CL_VIRUS) { /* scan the raw file */
int typerec;
type == CL_UNKNOWN_TYPE ? (typerec = 1) : (typerec = 0);
type == CL_UNKNOWN_TEXT_TYPE ? (typerec = 1) : (typerec = 0);
lseek(desc, 0, SEEK_SET);
if((nret = cli_scandesc(desc, virname, scanned, root, typerec)) == CL_VIRUS) {

Loading…
Cancel
Save