From 25ba8c63d2138da5cb7fa9b4ad307504073fd640 Mon Sep 17 00:00:00 2001 From: Trog Date: Mon, 8 Mar 2004 12:30:05 +0000 Subject: [PATCH] minor code cleanup and bug fix git-svn: trunk@382 --- clamav-devel/ChangeLog | 3 +++ clamav-devel/libclamav/ole2_extract.c | 16 ++++++++-------- clamav-devel/libclamav/vba_extract.c | 25 ++++++++++++------------- 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/clamav-devel/ChangeLog b/clamav-devel/ChangeLog index 326ef8b41..3258a81b0 100644 --- a/clamav-devel/ChangeLog +++ b/clamav-devel/ChangeLog @@ -1,3 +1,6 @@ +Mon Mar 8 12:37:26 GMT 2004 (trog) +----------------------------------- + * libclamav: vba_extract.c/ole2_extract.c: minor code cleanup and bug fix Mon Mar 8 10:01:01 GMT 2004 (trog) ----------------------------------- * clamd: wrap select()/poll() diff --git a/clamav-devel/libclamav/ole2_extract.c b/clamav-devel/libclamav/ole2_extract.c index 3e6940bdf..768296825 100644 --- a/clamav-devel/libclamav/ole2_extract.c +++ b/clamav-devel/libclamav/ole2_extract.c @@ -97,7 +97,7 @@ typedef struct ole2_header_tag /* must take account of the size of variables below here when reading the header */ int32_t sbat_root_start; -} ole2_header_t __attribute__ ((packed)); +} __attribute__ ((packed)) ole2_header_t; typedef struct property_tag { @@ -110,7 +110,7 @@ typedef struct property_tag int32_t child; unsigned char clsid[16]; - uint16_t user_flags; + uint32_t user_flags; uint32_t create_lowdate; uint32_t create_highdate; @@ -119,7 +119,7 @@ typedef struct property_tag int32_t start_block; int32_t size; unsigned char reserved[4]; -} property_t __attribute__ ((packed)); +} __attribute__ ((packed)) property_t; #ifdef HAVE_PRAGMA_PACK #pragma pack() @@ -135,10 +135,10 @@ int readn(int fd, void *buff, unsigned int count) { int retval; unsigned int todo; - void *current; + unsigned char *current; todo = count; - current = buff; + current = (unsigned char *) buff; do { retval = read(fd, current, todo); @@ -162,10 +162,10 @@ int writen(int fd, void *buff, unsigned int count) { int retval; unsigned int todo; - void *current; + unsigned char *current; todo = count; - current = buff; + current = (unsigned char *) buff; do { retval = write(fd, current, todo); @@ -455,7 +455,7 @@ void ole2_read_property_tree(int fd, ole2_header_t *hdr, const char *dir, prop_block[index].prev = ole2_endian_convert_32(prop_block[index].prev); prop_block[index].next = ole2_endian_convert_32(prop_block[index].next); prop_block[index].child = ole2_endian_convert_32(prop_block[index].child); - prop_block[index].user_flags = ole2_endian_convert_16(prop_block[index].user_flags); + prop_block[index].user_flags = ole2_endian_convert_32(prop_block[index].user_flags); prop_block[index].create_lowdate = ole2_endian_convert_32(prop_block[index].create_lowdate); prop_block[index].create_highdate = ole2_endian_convert_32(prop_block[index].create_highdate); prop_block[index].mod_lowdate = ole2_endian_convert_32(prop_block[index].mod_lowdate); diff --git a/clamav-devel/libclamav/vba_extract.c b/clamav-devel/libclamav/vba_extract.c index dd8780f0d..4f7600bbb 100644 --- a/clamav-devel/libclamav/vba_extract.c +++ b/clamav-devel/libclamav/vba_extract.c @@ -100,10 +100,10 @@ int vba_readn(int fd, void *buff, unsigned int count) { int retval; unsigned int todo; - void *current; + unsigned char *current; todo = count; - current = buff; + current = (unsigned char *) buff; do { retval = read(fd, current, todo); @@ -127,11 +127,11 @@ int vba_writen(int fd, void *buff, unsigned int count) { int retval; unsigned int todo; - void *current; - + unsigned char *current; + todo = count; - current = buff; - + current = (unsigned char *) buff; + do { retval = write(fd, current, todo); if (retval < 0) { @@ -140,7 +140,7 @@ int vba_writen(int fd, void *buff, unsigned int count) todo -= retval; current += retval; } while (todo > 0); - + return count; } @@ -148,11 +148,11 @@ char *get_unicode_name(char *name, int size) { int i, j; char *newname; - - if (*name == 0 || size == 0) { + + if (*name == 0 || size == 0) { return NULL; } - + newname = (char *) cli_malloc(size*2); if (!newname) { return NULL; @@ -185,7 +185,7 @@ static void vba56_test_middle(int fd) if (vba_readn(fd, &test_middle, 20) != 20) { return; } - + if (memcmp(test_middle, middle_str, 20) != 0) { lseek(fd, -20, SEEK_CUR); } @@ -205,7 +205,7 @@ static void vba56_test_end(int fd) if (vba_readn(fd, &test_end, 20) != 20) { return; } - + if (memcmp(test_end, end_str, 20) != 0) { lseek(fd, -20, SEEK_CUR); } @@ -238,7 +238,6 @@ vba_project_t *vba56_dir_read(const char *dir) unsigned char fixed_octet[8] = { 0x06, 0x02, 0x01, 0x00, 0x08, 0x02, 0x00, 0x00 }; - cli_dbgmsg("in vba56_dir_read()\n"); fullname = (char *) cli_malloc(strlen(dir) + 15);