Browse code

Removed more unused code

git-svn: trunk@3368

Nigel Horne authored on 2007/11/13 03:42:44
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Mon Nov 12 17:47:21 GMT 2007 (njh)
2
+----------------------------------
3
+  * libclamav/vba_extract.c:	Removed more unused code
4
+
1 5
 Mon Nov 12 01:09:13 CET 2007 (acab)
2 6
 -----------------------------------
3 7
   * libclamav/spin.c: Minor improvements
... ...
@@ -50,6 +50,10 @@
50 50
 #define __attribute__(x)
51 51
 #endif
52 52
 
53
+#define PPT_LZW_BUFFSIZE 8192
54
+#define NUM_VBA_VERSIONS 14
55
+#define VBA_COMPRESSION_WINDOW 4096
56
+
53 57
 #ifdef HAVE_PRAGMA_PACK
54 58
 #pragma pack(1)
55 59
 #endif
... ...
@@ -84,7 +88,6 @@ struct vba56_header {
84 84
 typedef struct vba_version_tag {
85 85
 	unsigned char signature[4];
86 86
 	const char *name;
87
-	int vba_version;
88 87
 	int is_mac;
89 88
 } vba_version_t;
90 89
 
... ...
@@ -104,32 +107,23 @@ static uint32_t vba_endian_convert_32(uint32_t value, int is_mac)
104 104
 		return le32_to_host(value);
105 105
 }
106 106
 
107
-#define NUM_VBA_VERSIONS 14
108 107
 static const vba_version_t vba_version[NUM_VBA_VERSIONS] = {
109
-	{ { 0x5e, 0x00, 0x00, 0x01 }, "Office 97",              5, FALSE},
110
-	{ { 0x5f, 0x00, 0x00, 0x01 }, "Office 97 SR1",          5, FALSE },
111
-	{ { 0x65, 0x00, 0x00, 0x01 }, "Office 2000 alpha?",     6, FALSE },
112
-	{ { 0x6b, 0x00, 0x00, 0x01 }, "Office 2000 beta?",      6, FALSE },
113
-	{ { 0x6d, 0x00, 0x00, 0x01 }, "Office 2000",            6, FALSE },
114
-	{ { 0x6f, 0x00, 0x00, 0x01 }, "Office 2000",            6, FALSE },
115
-	{ { 0x70, 0x00, 0x00, 0x01 }, "Office XP beta 1/2",     6, FALSE },
116
-	{ { 0x73, 0x00, 0x00, 0x01 }, "Office XP",              6, FALSE },
117
-	{ { 0x76, 0x00, 0x00, 0x01 }, "Office 2003",            6, FALSE },
118
-	{ { 0x79, 0x00, 0x00, 0x01 }, "Office 2003",            6, FALSE },
119
-	{ { 0x60, 0x00, 0x00, 0x0e }, "MacOffice 98",           5, TRUE },
120
-	{ { 0x62, 0x00, 0x00, 0x0e }, "MacOffice 2001",         5, TRUE },
121
-	{ { 0x63, 0x00, 0x00, 0x0e }, "MacOffice X",		6, TRUE },
122
-	{ { 0x64, 0x00, 0x00, 0x0e }, "MacOffice 2004",         6, TRUE },
108
+	{ { 0x5e, 0x00, 0x00, 0x01 }, "Office 97",              FALSE},
109
+	{ { 0x5f, 0x00, 0x00, 0x01 }, "Office 97 SR1",          FALSE },
110
+	{ { 0x65, 0x00, 0x00, 0x01 }, "Office 2000 alpha?",     FALSE },
111
+	{ { 0x6b, 0x00, 0x00, 0x01 }, "Office 2000 beta?",      FALSE },
112
+	{ { 0x6d, 0x00, 0x00, 0x01 }, "Office 2000",            FALSE },
113
+	{ { 0x6f, 0x00, 0x00, 0x01 }, "Office 2000",            FALSE },
114
+	{ { 0x70, 0x00, 0x00, 0x01 }, "Office XP beta 1/2",     FALSE },
115
+	{ { 0x73, 0x00, 0x00, 0x01 }, "Office XP",              FALSE },
116
+	{ { 0x76, 0x00, 0x00, 0x01 }, "Office 2003",            FALSE },
117
+	{ { 0x79, 0x00, 0x00, 0x01 }, "Office 2003",            FALSE },
118
+	{ { 0x60, 0x00, 0x00, 0x0e }, "MacOffice 98",           TRUE },
119
+	{ { 0x62, 0x00, 0x00, 0x0e }, "MacOffice 2001",         TRUE },
120
+	{ { 0x63, 0x00, 0x00, 0x0e }, "MacOffice X",		TRUE },
121
+	{ { 0x64, 0x00, 0x00, 0x0e }, "MacOffice 2004",         TRUE },
123 122
 };
124 123
 
125
-#define VBA56_DIRENT_RECORD_COUNT (2 + /* magic */              \
126
-                                   4 + /* version */            \
127
-                                   2 + /* 0x00 0xff */          \
128
-                                  22)  /* unknown */
129
-#define VBA56_DIRENT_HEADER_SIZE (VBA56_DIRENT_RECORD_COUNT +   \
130
-                                  2 +  /* type1 record count */ \
131
-                                  2)   /* unknown */
132
-
133 124
 static char *
134 125
 get_unicode_name(const char *name, int size, int is_mac)
135 126
 {
... ...
@@ -329,8 +323,7 @@ vba_project_t *vba56_dir_read(const char *dir)
329 329
 				return NULL;
330 330
 		}
331 331
 	} else {
332
-		cli_dbgmsg("VBA Project: %s, VBA Version=%d\n", vba_version[i].name,
333
-                                vba_version[i].vba_version);
332
+		cli_dbgmsg("VBA Project: %s\n", vba_version[i].name);
334 333
 		is_mac = vba_version[i].is_mac;
335 334
 	}
336 335
 
... ...
@@ -507,8 +500,6 @@ vba_project_t *vba56_dir_read(const char *dir)
507 507
 	return vba_project;
508 508
 }
509 509
 
510
-#define VBA_COMPRESSION_WINDOW 4096
511
-
512 510
 unsigned char *vba_decompress(int fd, uint32_t offset, int *size)
513 511
 {
514 512
 	unsigned int i, pos=0, shift, win_pos, clean=TRUE, mask, distance;
... ...
@@ -739,23 +730,18 @@ static void ppt_print_atom_header(atom_header_t *atom_header)
739 739
 	cli_dbgmsg("  Length: 0x%.8x\n", atom_header->length);
740 740
 }
741 741
 
742
-#define PPT_LZW_BUFFSIZE 8192
743 742
 static int ppt_unlzw(const char *dir, int fd, uint32_t length)
744 743
 {
745 744
 	int ofd, retval;
746 745
 	unsigned char inbuff[PPT_LZW_BUFFSIZE], outbuff[PPT_LZW_BUFFSIZE];
747
-	char *fullname;
748 746
 	uint32_t bufflen;
749 747
 	z_stream stream;
748
+	char fullname[NAME_MAX + 1];
750 749
 
751
-	fullname = cli_malloc(strlen(dir) + 17);
752
-	if (!fullname) {
753
-		return FALSE;
754
-	}
755
-	sprintf(fullname, "%s/ppt%.8lx.doc", dir, (long)lseek(fd, 0L, SEEK_CUR));
750
+	snprintf(fullname, sizeof(fullname) - 1, "%s/ppt%.8lx.doc",
751
+		dir, (long)lseek(fd, 0L, SEEK_CUR));
756 752
 
757 753
 	ofd = open(fullname, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0600);
758
-	free(fullname);
759 754
 	if (ofd == -1) {
760 755
 		cli_dbgmsg("ppt_unlzw Open outfile failed\n");
761 756
 		return FALSE;