try to detect international text data

git-svn: trunk@1448
remotes/push_mirror/metadata
Tomasz Kojm 21 years ago
parent acb87f87d6
commit e88f97f3a6
  1. 6
      clamav-devel/ChangeLog
  2. 22
      clamav-devel/libclamav/filetypes.c

@ -1,6 +1,10 @@
Tue Mar 29 02:50:30 CEST 2005 (tk)
----------------------------------
* libclamav/filetypes.c: try to detect international text data
Tue Mar 29 02:02:05 CEST 2005 (tk)
----------------------------------
* libclamav: detect and ignore ISO 9660/High Sierra CD-ROM data
* libclamav/filetypes.c: detect and ignore ISO 9660/High Sierra CD-ROM data
Mon Mar 28 12:05:17 BST 2005 (njh)
----------------------------------

@ -173,6 +173,26 @@ static const struct cli_smagic_s cli_smagic[] = {
{NULL, NULL, CL_TYPE_UNKNOWN_DATA}
};
static char internat[256] = {
/* TODO: Remember to buy a beer to Joerg Wunsch <joerg@FreeBSD.ORG> */
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, /* 0x0X */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, /* 0x1X */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x2X */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x3X */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x4X */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x5X */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x6X */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, /* 0x7X */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x8X */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x9X */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0xaX */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0xbX */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0xcX */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0xdX */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0xeX */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 /* 0xfX */
};
cli_file_t cli_filetype(const char *buf, size_t buflen)
{
int i, ascii = 1, len;
@ -189,7 +209,7 @@ cli_file_t cli_filetype(const char *buf, size_t buflen)
buflen < 25 ? (len = buflen) : (len = 25);
for(i = 0; i < len; i++)
if(!iscntrl(buf[i]) && !isprint(buf[i])) { /* FIXME: handle international chars */
if(!iscntrl(buf[i]) && !isprint(buf[i]) && !internat[buf[i] & 0xff]) {
ascii = 0;
break;
}

Loading…
Cancel
Save