Browse code

properly initialise hdr.max_block_no (bb#603)

git-svn: trunk@3186

Tomasz Kojm authored on 2007/08/22 05:34:03
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Tue Aug 21 21:39:06 CEST 2007 (tk)
2
+----------------------------------
3
+  * libclamav/ole2_extract.c: properly initialise hdr.max_block_no (bb#603)
4
+
1 5
 Tue Aug 21 21:35:10 CEST 2007 (tk)
2 6
 ----------------------------------
3 7
   * libclamav/htmlnorm.c: fix possible NULL dereference (bb#582),
... ...
@@ -485,7 +485,7 @@ static void ole2_walk_property_tree(int fd, ole2_header_t *hdr, const char *dir,
485 485
 		cli_dbgmsg("OLE2: Recursion limit reached (max: %d)\n", limits->maxreclevel);
486 486
 		return;
487 487
 	}
488
-	
488
+
489 489
 	index = prop_index / 4;
490 490
 	for (i=0 ; i < index ; i++) {
491 491
 		current_block = ole2_get_next_block_number(fd, hdr, current_block);
... ...
@@ -836,8 +836,6 @@ int cli_ole2_extract(int fd, const char *dirname, const struct cl_limits *limits
836 836
 	hdr.xbat_count = ole2_endian_convert_32(hdr.xbat_count);
837 837
 
838 838
 	hdr.sbat_root_start = -1;
839
-	/* 8 SBAT blocks per file block */
840
-	hdr.max_block_no = ((statbuf.st_size / hdr.log2_big_block_size) + 1) * 8;
841 839
 
842 840
 	hdr.bitset = cli_bitset_init();
843 841
 	if (!hdr.bitset) {
... ...
@@ -867,6 +865,9 @@ int cli_ole2_extract(int fd, const char *dirname, const struct cl_limits *limits
867 867
 		cli_errmsg("WARNING: not scanned; untested sbat cutoff - please report\n");
868 868
 		goto abort;
869 869
 	}
870
+
871
+	/* 8 SBAT blocks per file block */
872
+	hdr.max_block_no = ((statbuf.st_size / hdr.log2_big_block_size) + 1) * 8;
870 873
 	
871 874
 	print_ole2_header(&hdr);
872 875
 	cli_dbgmsg("Max block number: %lu\n", hdr.max_block_no);