Link Here
|
111 |
int32_t sbat_root_start __attribute__ ((packed)); |
111 |
int32_t sbat_root_start __attribute__ ((packed)); |
112 |
unsigned char *m_area; |
112 |
unsigned char *m_area; |
113 |
off_t m_length; |
113 |
off_t m_length; |
|
|
114 |
bitset_t *bitset; |
114 |
} ole2_header_t; |
115 |
} ole2_header_t; |
115 |
|
116 |
|
116 |
typedef struct property_tag |
117 |
typedef struct property_tag |
Link Here
|
468 |
if ((prop_index < 0) || (rec_level > 100) || (*file_count > 100000)) { |
469 |
if ((prop_index < 0) || (rec_level > 100) || (*file_count > 100000)) { |
469 |
return; |
470 |
return; |
470 |
} |
471 |
} |
471 |
|
472 |
|
472 |
if (limits && limits->maxfiles && (*file_count > limits->maxfiles)) { |
473 |
if (limits && limits->maxfiles && (*file_count > limits->maxfiles)) { |
473 |
cli_dbgmsg("OLE2: File limit reached (max: %d)\n", limits->maxfiles); |
474 |
cli_dbgmsg("OLE2: File limit reached (max: %d)\n", limits->maxfiles); |
474 |
return; |
475 |
return; |
Link Here
|
507 |
prop_block[index].size = ole2_endian_convert_32(prop_block[index].size); |
508 |
prop_block[index].size = ole2_endian_convert_32(prop_block[index].size); |
508 |
|
509 |
|
509 |
print_ole2_property(&prop_block[index]); |
510 |
print_ole2_property(&prop_block[index]); |
|
|
511 |
|
512 |
/* Check we aren't in a loop */ |
513 |
if (cli_bitset_test(hdr->bitset, (unsigned long) prop_index)) { |
514 |
/* Loop in property tree detected */ |
515 |
cli_dbgmsg("OLE2: Property tree loop detected at index %d\n", prop_index); |
516 |
return; |
517 |
} |
518 |
if (!cli_bitset_set(hdr->bitset, (unsigned long) prop_index)) { |
519 |
return; |
520 |
} |
521 |
|
510 |
switch (prop_block[index].type) { |
522 |
switch (prop_block[index].type) { |
511 |
case 5: /* Root Entry */ |
523 |
case 5: /* Root Entry */ |
512 |
if ((prop_index != 0) || (rec_level !=0) || |
524 |
if ((prop_index != 0) || (rec_level !=0) || |
Link Here
|
745 |
|
757 |
|
746 |
/* size of header - size of other values in struct */ |
758 |
/* size of header - size of other values in struct */ |
747 |
hdr_size = sizeof(struct ole2_header_tag) - sizeof(int32_t) - |
759 |
hdr_size = sizeof(struct ole2_header_tag) - sizeof(int32_t) - |
748 |
sizeof(unsigned char *) - sizeof(off_t); |
760 |
sizeof(unsigned char *) - sizeof(off_t) - sizeof(bitset_t *); |
749 |
|
761 |
|
750 |
hdr.m_area = NULL; |
762 |
hdr.m_area = NULL; |
751 |
|
763 |
|
Link Here
|
791 |
hdr.xbat_count = ole2_endian_convert_32(hdr.xbat_count); |
803 |
hdr.xbat_count = ole2_endian_convert_32(hdr.xbat_count); |
792 |
|
804 |
|
793 |
hdr.sbat_root_start = -1; |
805 |
hdr.sbat_root_start = -1; |
794 |
|
806 |
|
|
|
807 |
hdr.bitset = cli_bitset_init(); |
808 |
if (!hdr.bitset) { |
809 |
return CL_EOLE2; |
810 |
} |
811 |
|
795 |
if (strncmp(hdr.magic, magic_id, 8) != 0) { |
812 |
if (strncmp(hdr.magic, magic_id, 8) != 0) { |
796 |
cli_dbgmsg("OLE2 magic failed!\n"); |
813 |
cli_dbgmsg("OLE2 magic failed!\n"); |
797 |
#ifdef HAVE_MMAP |
814 |
#ifdef HAVE_MMAP |
Link Here
|
799 |
munmap(hdr.m_area, hdr.m_length); |
816 |
munmap(hdr.m_area, hdr.m_length); |
800 |
} |
817 |
} |
801 |
#endif |
818 |
#endif |
|
|
819 |
cli_bitset_free(hdr.bitset); |
802 |
return CL_EOLE2; |
820 |
return CL_EOLE2; |
803 |
} |
821 |
} |
804 |
|
822 |
|
Link Here
|
831 |
munmap(hdr.m_area, hdr.m_length); |
849 |
munmap(hdr.m_area, hdr.m_length); |
832 |
} |
850 |
} |
833 |
#endif |
851 |
#endif |
|
|
852 |
cli_bitset_free(hdr.bitset); |
834 |
return 0; |
853 |
return 0; |
835 |
} |
854 |
} |