diff --git a/clamav-devel/ChangeLog b/clamav-devel/ChangeLog index 4370e4929..3f7fcdb5a 100644 --- a/clamav-devel/ChangeLog +++ b/clamav-devel/ChangeLog @@ -1,3 +1,8 @@ +Tue Nov 14 13:49:58 GMT 2006 (trog) +----------------------------------- + * libclamav/ole2_extract.c: Fix Solaris endian issue. (bb#89) + * libclamav/unrar/unrar.c: Fix FD leak in error path (bb#133, thanks acab) + Sat Nov 11 20:09:07 GMT 2006 (njh) ---------------------------------- * clamav-milter: SESSIONS mode: force --external, bug 123 diff --git a/clamav-devel/libclamav/ole2_extract.c b/clamav-devel/libclamav/ole2_extract.c index 437e3642b..7a0f8ee97 100644 --- a/clamav-devel/libclamav/ole2_extract.c +++ b/clamav-devel/libclamav/ole2_extract.c @@ -100,12 +100,12 @@ typedef struct ole2_header_tag typedef struct property_tag { unsigned char name[64] __attribute__ ((packed)); /* in unicode */ - int16_t name_size __attribute__ ((packed)); + uint16_t name_size __attribute__ ((packed)); unsigned char type __attribute__ ((packed)); /* 1=dir 2=file 5=root */ unsigned char color __attribute__ ((packed)); /* black or red */ - int32_t prev __attribute__ ((packed)); - int32_t next __attribute__ ((packed)); - int32_t child __attribute__ ((packed)); + uint32_t prev __attribute__ ((packed)); + uint32_t next __attribute__ ((packed)); + uint32_t child __attribute__ ((packed)); unsigned char clsid[16] __attribute__ ((packed)); uint32_t user_flags __attribute__ ((packed)); @@ -114,8 +114,8 @@ typedef struct property_tag uint32_t create_highdate __attribute__ ((packed)); uint32_t mod_lowdate __attribute__ ((packed)); uint32_t mod_highdate __attribute__ ((packed)); - int32_t start_block __attribute__ ((packed)); - int32_t size __attribute__ ((packed)); + uint32_t start_block __attribute__ ((packed)); + uint32_t size __attribute__ ((packed)); unsigned char reserved[4] __attribute__ ((packed)); } property_t; @@ -202,7 +202,7 @@ static void print_ole2_property(property_t *property) default: cli_dbgmsg(" u "); } - cli_dbgmsg(" %d %x\n", property->size, property->user_flags); + cli_dbgmsg(" 0x%.8x 0x%.8x\n", property->size, property->user_flags); } static void print_ole2_header(ole2_header_t *hdr) @@ -447,8 +447,9 @@ static void ole2_walk_property_tree(int fd, ole2_header_t *hdr, const char *dir, property_t prop_block[4]; int32_t index, current_block, i; unsigned char *dirname; + current_block = hdr->prop_start; - + if ((prop_index < 0) || (rec_level > 100) || (*file_count > 100000)) { return; } @@ -602,7 +603,6 @@ static int handler_writefile(int fd, ole2_header_t *hdr, property_t *prop, const } } - newname = (char *) cli_malloc(strlen(name) + strlen(dir) + 2); if (!newname) { free(name); diff --git a/clamav-devel/libclamav/unrar/unrar.c b/clamav-devel/libclamav/unrar/unrar.c index f95c9d164..08778c80d 100644 --- a/clamav-devel/libclamav/unrar/unrar.c +++ b/clamav-devel/libclamav/unrar/unrar.c @@ -1584,6 +1584,7 @@ rar_metadata_t *cli_unrar(int fd, const char *dirname, const struct cl_limits *l } else { if ((file_count == 1) && (file_header->flags & LHD_SOLID)) { cli_warnmsg("RAR: First file can't be SOLID.\n"); + close(ofd); break; } else { retval = rar_unpack(fd, file_header->unpack_ver, @@ -1601,6 +1602,7 @@ rar_metadata_t *cli_unrar(int fd, const char *dirname, const struct cl_limits *l cli_dbgmsg("Corrupt file detected\n"); if (file_header->flags & LHD_SOLID) { cli_dbgmsg("SOLID archive, can't continue\n"); + close(ofd); break; } }