Browse code

OLE2 fixes

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

Tomasz Kojm authored on 2004/01/25 15:34:45
Showing 14 changed files
... ...
@@ -1,27 +1,37 @@
1 1
 Tomasz Kojm <tkojm*clamav.net>
2 2
 home page : http://www.konarski.edu.pl/~zolw
3 3
 gpg key   : http://www.clamav.net/gpg/tkojm.gpg
4
-GPG = 0DCA 5A08 407D 5288 279D  B434 5482 2DC8 985A 444B
4
+GPG fingerprint = 0DCA 5A08 407D 5288 279D  B434 5482 2DC8 985A 444B
5
+Project leader.
5 6
 
6 7
 Nigel Horne <njh*clamav.net>
7 8
 home page : http://bandsman.co.uk
8 9
 Author of clamav-milter and the whole mbox code.
9 10
 
10
-System administrator (www, mailing lists, mirror issues, virus
11
-submission mechanisms): Luca 'NERvOus' Gibelli <nervous*clamav.net>
11
+Luca 'NERvOus' Gibelli <nervous*clamav.net>
12
+home page : http://www.nervous.it
13
+GPG fingerprint = C782 121E 8C3A 90E3 7A87  D802 6277 8FF4 5EFC 5582
14
+System administrator (WWW, mailing lists, mirror mechanism, virus
15
+submission mechanism)
12 16
 
13 17
 Submission management interface (for database developers only): Diego D'Ambra
14 18
 <diego*clamav.net>, Thomas Madsen <tm*softcom.dk>
15 19
 
16
-
17 20
 Database developers:
18 21
 
19 22
 aCaB <acab*clamav.net>
20 23
 Diego D'Ambra <diego*clamav.net>
21 24
 Jason Englander <jason*clamav.net>
22 25
 Tomasz Kojm <tkojm*clamav.net>
26
+
23 27
 Denis De Messemacker <ddm*clamav.net>
28
+gpg key   : http://www.clamav.net/gpg/ddm.gpg
29
+GPG fingerprint = E697 81BD A912 3F5A 737E  C254 B3B1 F81A 0278 7880
30
+
24 31
 Tomasz Papszun <tomek*clamav.net>
32
+gpg key	  : http://www.lodz.tpsa.pl/~tomek/pgp.txt
33
+GPG fingerprint = F115 0CA4 775D 9898 6F32  0F98 C0C2 2079 C1CA 59EE
34
+
25 35
 
26 36
 ClamAV logo: Mia Kalenius and Sergei Pronin <sp*finndesign.fi>
27 37
 TrashScan was written by Trashware <trashware*gmx.net>.
... ...
@@ -1,3 +1,10 @@
1
+Sun Jan 25 07:31:00 CET 2004 (tk)
2
+---------------------------------
3
+  * libclamav: VBA wrapper - fixed NULL dereference in new code (reported
4
+	       by Nigel)
5
+  * clamscan: fixed possible crash with uninitialized filename variable
6
+	      (thanks to Nigel)
7
+
1 8
 Sat Jan 24 18:17:51 GMT 2004 (njh)
2 9
 ----------------------------------
3 10
   * clamav-milter: Allow clamd server name as well as IPaddress in -s option
... ...
@@ -57,7 +57,7 @@ int main(int argc, char **argv)
57 57
     if(setrlimit(RLIMIT_CORE, &rlim) < 0)
58 58
 	perror("setrlimit");
59 59
 #endif
60
-    opt=(struct optstruct*)mmalloc(sizeof(struct optstruct));
60
+    opt=(struct optstruct*)mcalloc(sizeof(struct optstruct));
61 61
     opt->optlist = NULL;
62 62
     opt->filename = NULL;
63 63
 
... ...
@@ -34,6 +34,7 @@
34 34
 #include "clamuko.h"
35 35
 #include "tests.h"
36 36
 #include "session.h"
37
+#include "../target.h"
37 38
 
38 39
 #ifdef CLAMUKO
39 40
 pthread_t clamukoid;
... ...
@@ -88,7 +88,7 @@ int main(int argc, char **argv)
88 88
     	};
89 89
 
90 90
 
91
-    opt=(struct optstruct*) mmalloc(sizeof(struct optstruct));
91
+    opt=(struct optstruct*) mcalloc(1, sizeof(struct optstruct));
92 92
     opt->optlist = NULL;
93 93
 
94 94
     while(1) {
... ...
@@ -42,7 +42,7 @@ Default: 1M
42 42
 \fBLogTime\fR
43 43
 Log time with each message.
44 44
 .br 
45
-Defayult: disabled.
45
+Default: disabled.
46 46
 .TP 
47 47
 \fBLogSyslog\fR
48 48
 Use system logger (can work together with LogFile).
... ...
@@ -59,7 +59,7 @@ int main(int argc, char **argv)
59 59
     	};
60 60
 
61 61
 
62
-    opt=(struct optstruct*)mmalloc(sizeof(struct optstruct));
62
+    opt=(struct optstruct*)mcalloc(sizeof(struct optstruct));
63 63
     opt->optlist = NULL;
64 64
 
65 65
     while(1) {
... ...
@@ -74,6 +74,7 @@ libclamav_la_SOURCES = \
74 74
 	ole2_extract.c \
75 75
 	ole2_extract.h \
76 76
 	vba_extract.c \
77
-	vba_extract.h
77
+	vba_extract.h \
78
+	cltypes.h
78 79
 
79 80
 lib_LTLIBRARIES = libclamav.la
... ...
@@ -173,7 +173,8 @@ libclamav_la_SOURCES = \
173 173
 	ole2_extract.c \
174 174
 	ole2_extract.h \
175 175
 	vba_extract.c \
176
-	vba_extract.h
176
+	vba_extract.h \
177
+	cltypes.h
177 178
 
178 179
 
179 180
 lib_LTLIBRARIES = libclamav.la
... ...
@@ -26,11 +26,12 @@
26 26
 #include <stdio.h>
27 27
 #include <string.h>
28 28
 #include <unistd.h>
29
-#include <stdint.h>
30 29
 #include <ctype.h>
31 30
 #include <stdlib.h>
32 31
 #include <clamav.h>
33 32
 
33
+#include "cltypes.h"
34
+
34 35
 #define FALSE (0)
35 36
 #define TRUE (1)
36 37
 
... ...
@@ -1,5 +1,5 @@
1 1
 /*
2
- *  Copyright (C) 2002, 2003 Tomasz Kojm <zolw@konarski.edu.pl>
2
+ *  Copyright (C) 2002 - 2004 Tomasz Kojm <tkojm@clamav.net>
3 3
  *
4 4
  *  This program is free software; you can redistribute it and/or modify
5 5
  *  it under the terms of the GNU General Public License as published by
... ...
@@ -29,8 +29,6 @@
29 29
 #  include <pthread.h>
30 30
 pthread_mutex_t cli_scanrar_mutex = PTHREAD_MUTEX_INITIALIZER;
31 31
 int cli_scanrar_inuse = 0;
32
-//pthread_mutex_t cli_mbox_mutex = PTHREAD_MUTEX_INITIALIZER;
33
-//int cli_mbox_inuse = 0;
34 32
 #endif
35 33
 
36 34
 #include "clamav.h"
... ...
@@ -596,16 +594,17 @@ int cli_scanole2(int desc, char **virname, long int *scanned, const struct cl_no
596 596
 		free(data);
597 597
 	    }
598 598
 
599
+	    for(i = 0; i < vba_project->count; i++)
600
+		free(vba_project->name[i]);
601
+	    free(vba_project->name);
602
+	    free(vba_project->dir);
603
+	    free(vba_project->offset);
604
+
599 605
 	} else {
600 606
 	    cli_errmsg("ScanOLE2 -> Can't decode VBA streams.\n");
601 607
 	    ret = CL_EOLE2;
602 608
 	}
603 609
 
604
-	for(i = 0; i < vba_project->count; i++)
605
-	    free(vba_project->name[i]);
606
-	free(vba_project->name);
607
-	free(vba_project->dir);
608
-	free(vba_project->offset);
609 610
 
610 611
 	cli_rmdirs(dir);
611 612
 	free(dir);
... ...
@@ -665,13 +664,6 @@ int cli_scanmail(int desc, char **virname, long int *scanned, const struct cl_no
665 665
     if(*reclev > 5) /* FIXME: a temporary workaround */
666 666
 	return CL_CLEAN;
667 667
 
668
-/*
669
-#ifdef CL_THREAD_SAFE
670
-    pthread_cleanup_push(cli_unlock_mutex, &cli_mbox_mutex);
671
-    pthread_mutex_lock(&cli_mbox_mutex);
672
-    cli_mbox_inuse = 1;
673
-#endif
674
-*/
675 668
     tmpdir = getenv("TMPDIR");
676 669
 
677 670
     if(tmpdir == NULL)
... ...
@@ -685,12 +677,6 @@ int cli_scanmail(int desc, char **virname, long int *scanned, const struct cl_no
685 685
 	dir = cl_gentemp(tmpdir);
686 686
 	if(mkdir(dir, 0700)) {
687 687
 	    cli_errmsg("ScanMail -> Can't create temporary directory %s\n", dir);
688
-/*
689
-#ifdef CL_THREAD_SAFE
690
-	    pthread_mutex_unlock(&cli_mbox_mutex);
691
-	    cli_mbox_inuse = 0;
692
-#endif
693
-*/
694 688
 	    return CL_ETMPDIR;
695 689
 	}
696 690
 
... ...
@@ -705,14 +691,6 @@ int cli_scanmail(int desc, char **virname, long int *scanned, const struct cl_no
705 705
 	cli_rmdirs(dir);
706 706
 	free(dir);
707 707
 
708
-/*
709
-#ifdef CL_THREAD_SAFE
710
-	pthread_mutex_unlock(&cli_mbox_mutex);
711
-        cli_mbox_inuse = 0;
712
-	pthread_cleanup_pop(0);
713
-#endif
714
-*/
715
-
716 708
 	return ret;
717 709
 }
718 710
 
... ...
@@ -1,5 +1,5 @@
1 1
 /*
2
- *  Extract VBA source code for component MS Office Documents)
2
+ *  Extract VBA source code for component MS Office Documents
3 3
  *
4 4
  *  Copyright (C) 2004 trog@uncon.org
5 5
  *
... ...
@@ -26,7 +26,6 @@
26 26
 #include <sys/types.h>
27 27
 #include <sys/stat.h>
28 28
 #include <fcntl.h>
29
-#include <stdint.h>
30 29
 #include <stdlib.h>
31 30
 #include <ctype.h>
32 31
 
... ...
@@ -175,15 +174,18 @@ vba_project_t *vba56_dir_read(const char *dir)
175 175
 	unsigned char fixed_octet[8] = { 0x06, 0x02, 0x01, 0x00, 0x08, 0x02, 0x00, 0x00 };
176 176
 
177 177
 
178
+	cli_dbgmsg("in vba56_dir_read()\n");
179
+
178 180
 	fullname = (char *) cli_malloc(strlen(dir) + 14);
179 181
 	sprintf(fullname, "%s/_VBA_PROJECT", dir);
180 182
         fd = open(fullname, O_RDONLY);
181
-	free(fullname);
182 183
 
183 184
         if (fd == -1) {
184
-                cli_errmsg("Open failed\n");
185
+                cli_dbgmsg("Can't open %s\n", fullname);
186
+		free(fullname);
185 187
                 return NULL;
186 188
         }
189
+	free(fullname);
187 190
 
188 191
 	if (vba_readn(fd, &magic, 2) != 2) {
189 192
 		return NULL;
... ...
@@ -202,7 +204,7 @@ vba_project_t *vba56_dir_read(const char *dir)
202 202
 	}
203 203
 
204 204
 	if (i == NUM_VBA_VERSIONS) {
205
-		cli_errmsg("Unknown VBA version signature x0%x0x%x0x%x0x%x\n",
205
+		cli_dbgmsg("Unknown VBA version signature x0%x0x%x0x%x0x%x\n",
206 206
 			version[0], version[1], version[2], version[3]);
207 207
 		return NULL;
208 208
 	}
... ...
@@ -1,5 +1,5 @@
1 1
 /*
2
- *  Extract VBA source code for component MS Office Documents)
2
+ *  Extract VBA source code for component MS Office Documents
3 3
  *
4 4
  *  Copyright (C) 2004 trog@uncon.org
5 5
  *
... ...
@@ -23,10 +23,7 @@
23 23
 #ifndef __VBA_EXTRACT_H
24 24
 #define __VBA_EXTRACT_H
25 25
 
26
-#include <unistd.h>
27
-#include <sys/types.h>
28
-#include <stdint.h>
29
-#include <stdlib.h>
26
+#include "cltypes.h"
30 27
 
31 28
 typedef struct vba_project_tag {
32 29
 	int count;
... ...
@@ -70,7 +70,7 @@ int main(int argc, char **argv)
70 70
 	perror("setrlimit");
71 71
 #endif
72 72
 
73
-    opt=(struct optstruct*)mmalloc(sizeof(struct optstruct));
73
+    opt=(struct optstruct*)mcalloc(sizeof(struct optstruct));
74 74
     opt->optlist = NULL;
75 75
 
76 76
     while(1) {