Skip to content

Commit

Permalink
bahl
Browse files Browse the repository at this point in the history
  • Loading branch information
ragusaa committed Aug 7, 2024
1 parent 428e7b7 commit 3520989
Showing 1 changed file with 0 additions and 90 deletions.
90 changes: 0 additions & 90 deletions libclamav/ole2_extract.c
Original file line number Diff line number Diff line change
Expand Up @@ -2885,96 +2885,6 @@ cl_error_t cli_ole2_extract(const char *dirname, cli_ctx *ctx, struct uniq **fil
hdr.xbat_start = ole2_endian_convert_32(hdr.xbat_start);
hdr.xbat_count = ole2_endian_convert_32(hdr.xbat_count);



#if 0
int32_t bat_count __attribute__((packed)); NUMBER of directory sectors
int32_t prop_start __attribute__((packed)); number of fat sectors

uint32_t signature __attribute__((packed)); first directory sector location
#endif
//fprintf(stderr, "%s::%d::Number of directory sectors = %d (0x%x)\n", __FUNCTION__, __LINE__, hdr.bat_count, hdr.bat_count);
//fprintf(stderr, "%s::%d::Number of FAT sectors = %d (0x%x)\n", __FUNCTION__, __LINE__, hdr.prop_start, hdr.prop_start);
//fprintf(stderr, "%s::%d::Transaction sector Number = %d (0x%x)\n", __FUNCTION__, __LINE__, hdr.signature, hdr.signature);

//fprintf(stderr, "%s::%d::First directory sector = %d (0x%x)\n", __FUNCTION__, __LINE__, hdr.signature * (1 << hdr.log2_big_block_size), hdr.signature * (1 << hdr.log2_big_block_size));

#if 0
unsigned char magic[8]; /* should be: 0xd0cf11e0a1b11ae1 */
unsigned char clsid[16];
uint16_t minor_version __attribute__((packed));
uint16_t dll_version __attribute__((packed)); //major version
int16_t byte_order __attribute__((packed)); /* -2=intel */

uint16_t log2_big_block_size __attribute__((packed)); /* usually 9 (2^9 = 512) */ //sector shift
uint16_t log2_small_block_size __attribute__((packed)); /* usually 6 (2^6 = 64) */ //mini sector shift
uint8_t reserved[6] __attribute__((packed));
uint32_t num_directory_sectors __attribute__((packed));
int32_t bat_count __attribute__((packed)); //num fat sectors
int32_t prop_start __attribute__((packed)); //first directory sector location

uint32_t signature __attribute__((packed)); //transaction signature number
uint32_t sbat_cutoff __attribute__((packed)); /* cutoff for files held
* in small blocks
* (4096) */
//ministream cutoff size

int32_t sbat_start __attribute__((packed)); //first mini fat sector location
int32_t sbat_block_count __attribute__((packed)); //number of minifat sectors
int32_t xbat_start __attribute__((packed)); //first DIFAT sector location
int32_t xbat_count __attribute__((packed)); //number of difat sectors
int32_t bat_array[109] __attribute__((packed)); //DIFAT

#endif
#if 0
{
size_t andy;
fprintf(stderr, "%s::%d::minor_version = %d (0x%x)\n", __FUNCTION__, __LINE__, hdr.minor_version, hdr.minor_version);
fprintf(stderr, "%s::%d::dll_version = %d (0x%x)\n", __FUNCTION__, __LINE__, hdr.dll_version, hdr.dll_version);
fprintf(stderr, "%s::%d::byte_order = %d (0x%x)\n", __FUNCTION__, __LINE__, hdr.byte_order, hdr.byte_order);
fprintf(stderr, "%s::%d::log2_big_block_size = %d (0x%x)\n", __FUNCTION__, __LINE__, hdr.log2_big_block_size, hdr.log2_big_block_size);
fprintf(stderr, "%s::%d::log2_small_block_size = %d (0x%x)\n", __FUNCTION__, __LINE__, hdr.log2_small_block_size, hdr.log2_small_block_size);
fprintf(stderr, "%s::%d::reserved::", __FUNCTION__, __LINE__);
for (andy = 0; andy < 6; andy++) {
fprintf(stderr, "%02x ", hdr.reserved[andy]);
}
fprintf(stderr, "\n");


fprintf(stderr, "%s::%d::num_directory_sectors = %d (0x%x)\n", __FUNCTION__, __LINE__, hdr.num_directory_sectors, hdr.num_directory_sectors);
fprintf(stderr, "%s::%d::bat_count = %d (0x%x)\n", __FUNCTION__, __LINE__, hdr.bat_count, hdr.bat_count);
fprintf(stderr, "%s::%d::prop_start = %d (0x%x)\n", __FUNCTION__, __LINE__, hdr.prop_start, hdr.prop_start);
fprintf(stderr, "%s::%d::signature = %d (0x%x)\n", __FUNCTION__, __LINE__, hdr.signature, hdr.signature);
fprintf(stderr, "%s::%d::sbat_cutoff = %d (0x%x)\n", __FUNCTION__, __LINE__, hdr.sbat_cutoff, hdr.sbat_cutoff);
fprintf(stderr, "%s::%d::sbat_start = %d (0x%x)\n", __FUNCTION__, __LINE__, hdr.sbat_start, hdr.sbat_start);
fprintf(stderr, "%s::%d::sbat_block_count = %d (0x%x)\n", __FUNCTION__, __LINE__, hdr.sbat_block_count, hdr.sbat_block_count);
fprintf(stderr, "%s::%d::xbat_start = %d (0x%x)\n", __FUNCTION__, __LINE__, hdr.xbat_start, hdr.xbat_start);
fprintf(stderr, "%s::%d::xbat_count = %d (0x%x)\n", __FUNCTION__, __LINE__, hdr.xbat_count, hdr.xbat_count);

/*
* The random block that we *don't* want that is stuffed in the middel is in the DIFAT.
* Need to skip it (1 << log2_big_block_size) and keep going.
*/
for (andy = 0; andy < NUM_DIFAT_ENTRIES; andy++) {
if (-1 == hdr.bat_array[andy]) {
break;
}
fprintf(stderr, "%s::%d::difat[%ld] = %d (0x%x)\n", __FUNCTION__, __LINE__, andy, hdr.bat_array[andy], hdr.bat_array[andy]);
fprintf(stderr, "%s::%d::RESERVED BLOCK::%x\n", __FUNCTION__, __LINE__, ((hdr.bat_array[andy]+1) << hdr.log2_big_block_size));
}





}
#endif






hdr.sbat_root_start = -1;

hdr.bitset = cli_bitset_init();
Expand Down

0 comments on commit 3520989

Please sign in to comment.