511
515
int32_t idx, current_block, i, curindex;
513
517
ole2_list_t node_list;
516
520
ole2_listmsg("ole2_walk_property_tree() called\n");
521
func_ret = CL_SUCCESS;
517
522
ole2_list_init(&node_list);
519
524
ole2_listmsg("rec_level: %d\n", rec_level);
602
607
hdr->sbat_root_start = prop_block[idx].start_block;
603
if ((prop_block[idx].child != -1) &&
604
(ret = ole2_walk_property_tree(hdr, dir, prop_block[idx].child, handler, rec_level + 1, file_count, ctx, scansize)) != CL_SUCCESS) {
605
ole2_list_delete(&node_list);
608
if (prop_block[idx].child != -1) {
609
ret = ole2_walk_property_tree(hdr, dir, prop_block[idx].child, handler, rec_level + 1, file_count, ctx, scansize);
610
if (ret != CL_SUCCESS) {
611
if ((ctx->options & CL_SCAN_ALLMATCHES) && (ret == CL_VIRUS)) {
615
ole2_list_delete(&node_list);
608
620
if (prop_block[idx].prev != -1) {
609
621
if ((ret=ole2_list_push(&node_list, prop_block[idx].prev)) != CL_SUCCESS) {
623
635
if (ctx && ctx->engine->maxfiles && ctx->scannedfiles + *file_count > ctx->engine->maxfiles) {
624
636
cli_dbgmsg("OLE2: files limit reached (max: %u)\n", ctx->engine->maxfiles);
625
637
ole2_list_delete(&node_list);
628
640
if (!ctx || !(ctx->engine->maxfilesize) || prop_block[idx].size <= ctx->engine->maxfilesize || prop_block[idx].size <= *scansize) {
630
642
*scansize -= prop_block[idx].size;
631
643
ole2_listmsg("running file handler\n");
632
if ((ret = handler(hdr, &prop_block[idx], dir, ctx)) != CL_SUCCESS) {
633
ole2_listmsg("file handler returned %d\n", ret);
634
ole2_list_delete(&node_list);
644
ret = handler(hdr, &prop_block[idx], dir, ctx);
645
if (ret != CL_SUCCESS) {
646
if ((ctx->options & CL_SCAN_ALLMATCHES) && (ret == CL_VIRUS)) {
650
ole2_listmsg("file handler returned %d\n", ret);
651
ole2_list_delete(&node_list);
638
656
cli_dbgmsg("OLE2: filesize exceeded\n");
640
if ((prop_block[idx].child != -1) &&
641
(ret = ole2_walk_property_tree(hdr, dir, prop_block[idx].child, handler, rec_level, file_count, ctx, scansize)) != CL_SUCCESS) {
642
ole2_list_delete(&node_list);
658
if (prop_block[idx].child != -1) {
659
ret = ole2_walk_property_tree(hdr, dir, prop_block[idx].child, handler, rec_level, file_count, ctx, scansize);
660
if (ret != CL_SUCCESS) {
661
if ((ctx->options & CL_SCAN_ALLMATCHES) && (ret == CL_VIRUS)) {
665
ole2_list_delete(&node_list);
645
670
if (prop_block[idx].prev != -1) {
646
671
if ((ret=ole2_list_push(&node_list, prop_block[idx].prev)) != CL_SUCCESS) {
674
699
cli_dbgmsg("OLE2 dir entry: %s\n", dirname);
677
if ((prop_block[idx].child != -1) &&
678
(ret = ole2_walk_property_tree(hdr, dirname, prop_block[idx].child, handler, rec_level + 1, file_count, ctx, scansize)) != CL_SUCCESS) {
679
ole2_list_delete(&node_list);
702
if (prop_block[idx].child != -1) {
703
ret = ole2_walk_property_tree(hdr, dirname, prop_block[idx].child, handler, rec_level + 1, file_count, ctx, scansize);
704
if (ret != CL_SUCCESS) {
705
if ((ctx->options & CL_SCAN_ALLMATCHES) && (ret == CL_VIRUS)) {
709
ole2_list_delete(&node_list);
682
714
if (prop_block[idx].prev != -1) {
683
715
if ((ret=ole2_list_push(&node_list, prop_block[idx].prev)) != CL_SUCCESS) {
947
979
if (lseek(ofd, 0, SEEK_SET) == -1) {
981
if (ctx && !(ctx->engine->keeptmp))
982
cli_unlink(tempfile);
986
cli_bitset_free(blk_bitset);
950
989
ret = cli_magic_scandesc(ofd, ctx);