Browse code

Small bugfixes

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

Tomasz Kojm authored on 2003/11/15 09:22:10
Showing 6 changed files
... ...
@@ -48,6 +48,7 @@ Mark Mielke <mark*mark.mielke.cc>
48 48
 Arkadiusz Miskiewicz <misiek*pld.org.pl>
49 49
 Hendrik Muhs <Hendrik.Muhs*student.uni-magdeburg.de>
50 50
 Masaki Ogawa <proc*mac.com>
51
+Rudolph Pereira <r.pereira*isu.usyd.edu.au>
51 52
 Ed Phillips <ed*UDel.Edu>
52 53
 Andreas Piesk <Andreas.Piesk*heise.de>
53 54
 Ant La Porte <ant*dvere.net>
... ...
@@ -1,3 +1,15 @@
1
+Sat Nov 15 01:17:29 CET 2003 (tk)
2
+---------------------------------
3
+  * libclamav: cli_scanzip: do malloc() outside of the zip scanning loop;
4
+	       handle properly write error condition (patches by Rudolph
5
+	       Pereira <r.pereira*isu.usyd.edu.au>)
6
+  * libclamav: zziplib: fixed comp. problem under FreeBSD 5 (Rudolph Pereira)
7
+  * freshclam: fixed compilation error under Cygwin (patch by Robert Hogan
8
+	       <robert*roberthogan.net>)
9
+  * libclamav: cli_scanzip: increased oversize ratio
10
+  * freshclam: always initialize the ipaddr variable (patch by Mark Mielke
11
+	       <mark@mark.mielke.cc>)
12
+
1 13
 Thu Nov 13 20:03:53 CET 2003 (tk)
2 14
 ---------------------------------
3 15
   * clamav-milter/Makefile: clamav-milter.8 manual path fixed
... ...
@@ -42,9 +42,9 @@
42 42
 void freshclam(struct optstruct *opt)
43 43
 {
44 44
 	int ret;
45
+	char *newdir;
45 46
 #ifndef C_CYGWIN
46 47
 	struct passwd *user;
47
-	char *newdir;
48 48
 	char *unpuser;
49 49
 
50 50
     if(optc(opt, 'u'))
... ...
@@ -143,7 +143,7 @@ int downloaddb(const char *localname, const char *remotename, const char *hostna
143 143
 	mprintf("Connecting via %s\n", proxy);
144 144
 
145 145
     if(ip[0])
146
-	hostfd = wwwconnect(ip, proxy, NULL); /* we use ip to connect */
146
+	hostfd = wwwconnect(ip, proxy, ipaddr); /* we use ip to connect */
147 147
     else
148 148
 	hostfd = wwwconnect(hostname, proxy, ipaddr);
149 149
 
... ...
@@ -61,7 +61,7 @@ int cli_scanrar_inuse = 0;
61 61
 #define DELIVERED_MAGIC_STR "Delivered-To: "
62 62
 #define BZIP_MAGIC_STR "BZh"
63 63
 
64
-#define ZIPOSDET 20 /* FIXME: Make it user definable */
64
+#define ZIPOSDET 50 /* FIXME: Make it user definable */
65 65
 
66 66
 int cli_magic_scandesc(int desc, char **virname, long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, int *reclev);
67 67
 
... ...
@@ -256,6 +256,11 @@ int cli_scanzip(int desc, char **virname, long int *scanned, const struct cl_nod
256 256
 
257 257
     fstat(desc, &source);
258 258
 
259
+    if(!(buff = (char *) cli_malloc(FILEBUFF))) {
260
+	zzip_dir_close(zdir);
261
+	return CL_EMEM;
262
+    }
263
+
259 264
     while(zzip_dir_read(zdir, &zdirent)) {
260 265
 
261 266
 	if(!zdirent.d_name || !strlen(zdirent.d_name)) { /* Mimail fix */
... ...
@@ -317,23 +322,18 @@ int cli_scanzip(int desc, char **virname, long int *scanned, const struct cl_nod
317 317
 	    break;
318 318
 	}
319 319
 
320
-	if(!(buff = (char *) cli_malloc(FILEBUFF))) {
321
-	    ret = CL_EMEM;
322
-	    break;
323
-	}
324 320
 
325 321
 	while((bytes = zzip_file_read(zfp, buff, FILEBUFF)) > 0) {
326 322
 	    if(fwrite(buff, bytes, 1, tmp)*bytes != bytes) {
327 323
 		cli_dbgmsg("Zip -> Can't fwrite() file: %s\n", strerror(errno));
328 324
 		zzip_file_close(zfp);
329
-		files++;
325
+		zzip_dir_close(zdir);
326
+		fclose(tmp);
330 327
 		free(buff);
331
-		ret = CL_EZIP;
332
-		break;
328
+		return CL_EZIP;
333 329
 	    }
334 330
 	}
335 331
 
336
-	free(buff);
337 332
 	zzip_file_close(zfp);
338 333
 
339 334
 	if(fflush(tmp) != 0) {
... ...
@@ -372,6 +372,8 @@ int cli_scanzip(int desc, char **virname, long int *scanned, const struct cl_nod
372 372
 	fclose(tmp);
373 373
 	tmp = NULL;
374 374
     }
375
+
376
+    free(buff);
375 377
     return ret;
376 378
 }
377 379
 
... ...
@@ -29,6 +29,11 @@
29 29
 # endif
30 30
 #endif
31 31
 
32
+#include <target.h>
33
+#ifdef TARGET_OS_FREEBSD
34
+#include <sys/types.h>
35
+#endif
36
+
32 37
 /* especially win32 platforms do not declare off_t so far - see zzip-msvc.h */
33 38
 #ifndef _zzip_off_t
34 39
 #ifdef   ZZIP_off_t