Browse code

Add signature for MacOffice 2004. Guess endianness of unknown versions of MS Office.

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

Trog authored on 2004/12/14 20:39:08
Showing 2 changed files
... ...
@@ -1,3 +1,9 @@
1
+Tue Dec 14 11:36:43 GMT 2004 (trog)
2
+-----------------------------------
3
+  * libclamav/vba_extract.c:
4
+	- Add signature for MacOffice 2004
5
+	- Guess endianness of unknown versions of MS Office.
6
+			
1 7
 Tue Dec 14 11:15:22 GMT 2004 (trog)
2 8
 -----------------------------------
3 9
   * sigtool/options.c sigtool/sigtool.c: New options: --vba and --vba-hex
... ...
@@ -91,7 +91,7 @@ typedef struct byte_array_tag {
91 91
 	unsigned char *data;
92 92
 } byte_array_t;
93 93
 
94
-#define NUM_VBA_VERSIONS 13
94
+#define NUM_VBA_VERSIONS 14
95 95
 vba_version_t vba_version[] = {
96 96
 	{ { 0x5e, 0x00, 0x00, 0x01 }, "Office 97",              5, FALSE},
97 97
 	{ { 0x5f, 0x00, 0x00, 0x01 }, "Office 97 SR1",          5, FALSE },
... ...
@@ -106,6 +106,7 @@ vba_version_t vba_version[] = {
106 106
 	{ { 0x60, 0x00, 0x00, 0x0e }, "MacOffice 98",           5, TRUE },
107 107
 	{ { 0x62, 0x00, 0x00, 0x0e }, "MacOffice 2001",         5, TRUE },
108 108
 	{ { 0x63, 0x00, 0x00, 0x0e }, "MacOffice X",		6, TRUE },
109
+	{ { 0x64, 0x00, 0x00, 0x0e }, "MacOffice 2004",         6, TRUE },
109 110
 };
110 111
 
111 112
 #define VBA56_DIRENT_RECORD_COUNT (2 + /* magic */              \
... ...
@@ -315,17 +316,25 @@ vba_project_t *vba56_dir_read(const char *dir)
315 315
 	}
316 316
 
317 317
 	if (i == NUM_VBA_VERSIONS) {
318
-		cli_dbgmsg("Unknown VBA version signature %x %x %x %x\n",
318
+		cli_warnmsg("Unknown VBA version signature %x %x %x %x\n",
319 319
 			version[0], version[1], version[2], version[3]);
320
-		close(fd);
321
-		return NULL;
320
+		if (version[3] == 0x01) {
321
+			cli_warnmsg("Guessing little-endian\n");
322
+			is_mac = FALSE;
323
+		} else if (version[3] == 0x0e) {
324
+			cli_warnmsg("Guessing big-endian\n");
325
+			is_mac = TRUE;
326
+		} else {
327
+			cli_warnmsg("Unable to guess VBA type\n");
328
+			close(fd);
329
+			return NULL;
330
+		}	
331
+	} else {
332
+		cli_dbgmsg("VBA Project: %s, VBA Version=%d\n", vba_version[i].name,
333
+                                vba_version[i].vba_version);
334
+		is_mac = vba_version[i].is_mac;
322 335
 	}
323 336
 
324
-	cli_dbgmsg("VBA Project: %s, VBA Version=%d\n", vba_version[i].name,
325
-				vba_version[i].vba_version);
326
-
327
-	is_mac = vba_version[i].is_mac;
328
-
329 337
 	/*****************************************/
330 338
 
331 339
 	/* two bytes, should be equal to 0x00ff */