Browse code

clamdscan segfault fixed

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

Tomasz Kojm authored on 2003/12/20 21:27:44
Showing 5 changed files
... ...
@@ -56,6 +56,7 @@ Ed Phillips <ed*UDel.Edu>
56 56
 Andreas Piesk <Andreas.Piesk*heise.de>
57 57
 Ant La Porte <ant*dvere.net>
58 58
 Thomas Quinot <thomas*cuivre.fr.eu.org>
59
+David Santinoli <david*santinoli.com>
59 60
 Matt Sullivan <matt*sullivan.gen.nz>
60 61
 Joe Talbott <josepht*cstone.net>
61 62
 Gernot Tenchio <g.tenchio*telco-tech.de>
... ...
@@ -1,3 +1,11 @@
1
+Sat Dec 20 13:25:23 CET 2003
2
+----------------------------------
3
+  * clamdscan: fixed a segmentation fault when invoked without arguments
4
+	       (patch by David Santinoli <david*santinoli.com>)
5
+  * libclamav: the memory limit and verbosity arguments in bzReadOpen() were
6
+	       swapped due to a bug in the bzip2 documentation (problem
7
+	       found by Tomasz Klim <tomek*euroneto.pl>, bzip2 author notified)
8
+
1 9
 Sun Dec 14 18:07:44 GMT 2003 (njh)
2 10
 ----------------------------------
3 11
   * libclamav: not all viruses were being found in embedded RFC822 messages
... ...
@@ -19,8 +19,6 @@
19 19
 #ifndef __CFGFILE_H
20 20
 #define __CFGFILE_H
21 21
 
22
-#include "options.h"
23
-
24 22
 #define LINE_LENGTH 1024
25 23
 
26 24
 
... ...
@@ -128,7 +128,9 @@ int client(const struct optstruct *opt)
128 128
     }
129 129
 
130 130
     
131
-    if(!strcmp(opt->filename, "-")) { /* scan data from stdin */
131
+    if(opt->filename == NULL || strlen(opt->filename) == 0) {
132
+	file = (char *) strdup(cwd);
133
+    } else if(!strcmp(opt->filename, "-")) { /* scan data from stdin */
132 134
 	if(write(sockd, "STREAM", 6) <= 0) {
133 135
 	    mprintf("@Can't write to the socket.\n");
134 136
 	    close(sockd);
... ...
@@ -196,8 +198,6 @@ int client(const struct optstruct *opt)
196 196
 
197 197
 	return claminfo.ifiles ? 1 : 0;
198 198
 
199
-    } else if(strlen(opt->filename) == 0) {
200
-	file = (char *) strdup(cwd);
201 199
     } else if(opt->filename[0] == '/') {
202 200
 	file = (char *) strdup(opt->filename);
203 201
     } else {
... ...
@@ -472,7 +472,7 @@ int cli_scanbzip(int desc, char **virname, long int *scanned, const struct cl_no
472 472
 	if(limits->archivememlim)
473 473
 	    memlim = 1;
474 474
 
475
-    if((bfd = BZ2_bzReadOpen(&bzerror, fs, memlim, 0, NULL, 0)) == NULL) {
475
+    if((bfd = BZ2_bzReadOpen(&bzerror, fs, 0, memlim, NULL, 0)) == NULL) {
476 476
 	cli_dbgmsg("Can't initialize bzip2 library (descriptor %d).\n", desc);
477 477
 	fclose(fs);
478 478
 	return CL_EBZIP;