Browse code

VBA alignment check. Should now work with all MacOffice documents.

git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@406 77e5149b-7576-45b1-b177-96237e5ba77b

Trog authored on 2004/03/17 20:45:15
Showing 2 changed files
... ...
@@ -1,3 +1,8 @@
1
+Wed Mar 17 11:53:05 GMT 2004 (trog)
2
+-----------------------------------
3
+  * libclamav/vba_extract.c: VBA alignment check. Should now work with
4
+	all MacOffice documents.
5
+
1 6
 Wed Mar 17 09:32:45 GMT 2004 (trog)
2 7
 -----------------------------------
3 8
   * libclamav/vba_extract.c: Add support for MacOffice98 documents
... ...
@@ -297,11 +297,6 @@ vba_project_t *vba56_dir_read(const char *dir)
297 297
 	cli_dbgmsg("VBA Project: %s, VBA Version=%d\n", vba_version[i].name,
298 298
 				vba_version[i].vba_version);
299 299
 
300
-	if (i == 9) {
301
-		cli_dbgmsg("MacOffice2001 not currently supported\n");
302
-		close(fd);
303
-		return NULL;
304
-	}
305 300
 	is_mac = vba_version[i].is_mac;
306 301
 
307 302
 	/*****************************************/
... ...
@@ -497,6 +492,16 @@ vba_project_t *vba56_dir_read(const char *dir)
497 497
 			return NULL;
498 498
 		}
499 499
 	} while(ooff != 0xFFFF);
500
+
501
+	/* check for alignment error */
502
+	lseek(fd, -3, SEEK_CUR);
503
+	if (vba_readn(fd, &ooff, 2) != 2) {
504
+ 		close(fd);
505
+		return NULL;
506
+	}
507
+	if (ooff != 0xFFFF) {
508
+		lseek(fd, 1, SEEK_CUR);
509
+	}
500 510
 	
501 511
 	if (vba_readn(fd, &ooff, 2) != 2) {
502 512
 		close(fd);