diff -Naur clamav-org/clamscan/clamscan.c clamav-my/clamscan/clamscan.c
--- clamav-org/clamscan/clamscan.c	2007-05-01 18:08:57.000000000 +0200
+++ clamav-my/clamscan/clamscan.c	2007-08-21 16:38:27.000000000 +0200
@@ -195,7 +195,15 @@
 	}
     }
 
-    memset(&info, 0, sizeof(struct s_info));
+    if(opt_check(opt, "threads")) {
+	if(!isnumb(opt_arg(opt, "threads"))) {
+	    logg("!--threads requires a natural number\n");
+	    opt_free(opt);
+	    return 40;
+	}
+    }
+
+    bzero(&info, sizeof(struct s_info));
 
 #ifdef C_WINDOWS
     _set_fmode(_O_BINARY);
@@ -332,5 +340,6 @@
     mprintf("    --jar[=FULLPATH]                     Enable support for .jar files\n");
     mprintf("    --tar[=FULLPATH]                     Enable support for .tar files\n");
     mprintf("    --deb[=FULLPATH to ar]               Enable support for .deb files\n");
-    mprintf("    --tgz[=FULLPATH]                     Enable support for .tar.gz, .tgz files\n\n");
+    mprintf("    --tgz[=FULLPATH]                     Enable support for .tar.gz, .tgz files\n");
+    mprintf("    --threads=#n                         Use #n threads to scan files\n");
 }
diff -Naur clamav-org/clamscan/clamscan_opt.h clamav-my/clamscan/clamscan_opt.h
--- clamav-org/clamscan/clamscan_opt.h	2007-05-01 18:08:57.000000000 +0200
+++ clamav-my/clamscan/clamscan_opt.h	2007-08-21 13:47:09.000000000 +0200
@@ -89,6 +89,7 @@
     {"tar", 2, 0, 0},
     {"tgz", 2, 0, 0},
     {"deb", 2, 0, 0},
+    {"threads", 1, 0, 0},
 
     /* developers only */
     {"dev-ac-only", 0, 0, 0},
diff -Naur clamav-org/clamscan/manager.c clamav-my/clamscan/manager.c
--- clamav-org/clamscan/manager.c	2007-05-28 14:47:33.000000000 +0200
+++ clamav-my/clamscan/manager.c	2007-08-21 23:38:07.000000000 +0200
@@ -75,6 +75,9 @@
 #define	O_BINARY    0
 #endif
 
+int max_threads, thread_nr = 0, threads_cnt = 0;
+pthread_t *threads = NULL;
+
 static int scandirs(const char *dirname, struct cl_engine *engine, const struct passwd *user, const struct optstruct *opt, const struct cl_limits *limits, int options)
 {
     return treewalk(dirname, engine, user, opt, limits, options, 1);
@@ -137,6 +140,20 @@
     return ret;
 }
 
+pthread_t *prepare_threads(char *nr) {
+
+    unsigned int proc_number = sysconf(_SC_NPROCESSORS_CONF);
+
+    if (nr == NULL) {
+	max_threads = proc_number * 3;
+	printf("%d\n", max_threads);
+    }
+    else
+	max_threads = atoi(nr);
+	
+    return (pthread_t *)calloc(sizeof(pthread_t), max_threads);
+}
+
 int scanmanager(const struct optstruct *opt)
 {
 	mode_t fmode;
@@ -202,6 +219,8 @@
 	}
 	free(dbdir);
     }
+    
+    threads = prepare_threads(opt_arg(opt, "threads"));
 
     if(!engine) {
 	logg("!Can't initialize the virus database\n");
@@ -380,6 +399,18 @@
 	    free(thefilename);
 	}
     }
+    
+    if (max_threads != 0) {
+    
+        ret = thread_nr;
+    
+	do {
+	    pthread_join(threads[ret], NULL);
+	    ret++;
+	    if (ret == max_threads)
+		ret = 0;
+	} while (ret != thread_nr);
+    }
 
     /* free the engine */
     cl_free(engine);
@@ -941,41 +972,44 @@
     return ret;
 }
 
-int scanfile(const char *filename, struct cl_engine *engine, const struct passwd *user, const struct optstruct *opt, const struct cl_limits *limits, unsigned int options)
+void *scanfile_org(void *arg)
 {
 	int ret, included, printclean = 1;
 	const struct optnode *optnode;
 	char *argument;
 #ifdef C_LINUX
 	struct stat sb;
+    struct scanfile_args *args = (struct scanfile_args *) arg;
 
     /* argh, don't scan /proc files */
     if(procdev)
-	if(stat(filename, &sb) != -1)
+	if(stat(args->filename, &sb) != -1)
 	    if(sb.st_dev == procdev) {
 		if(!printinfected)
-		    logg("%s: Excluded (/proc)\n", filename);
-		return 0;
+		    logg("%s: Excluded (/proc)\n", args->filename);
+		if (max_threads > 0) pthread_exit(NULL);
 	    }
 #endif    
 
-    if(opt_check(opt, "exclude")) {
-	argument = opt_firstarg(opt, "exclude", &optnode);
+    if(opt_check(args->opt, "exclude")) {
+
+	argument = opt_firstarg(args->opt, "exclude", &optnode);
+	
 	while(argument) {
-	    if(match_regex(filename, argument) == 1) {
+	    if(match_regex(args->filename, argument) == 1) {
 		if(!printinfected)
-		    logg("%s: Excluded\n", filename);
-		return 0;
+		    logg("%s: Excluded\n", args->filename);
+		if (max_threads > 0) pthread_exit(NULL); else return;
 	    }
 	    argument = opt_nextarg(&optnode, "exclude");
 	}
     }
 
-   if(opt_check(opt, "include")) {
+   if(opt_check(args->opt, "include")) {
 	included = 0;
-	argument = opt_firstarg(opt, "include", &optnode);
+	argument = opt_firstarg(args->opt, "include", &optnode);
 	while(argument && !included) {
-	    if(match_regex(filename, argument) == 1) {
+	    if(match_regex(args->filename, argument) == 1) {
 		included = 1;
 		break;
 	    }
@@ -984,23 +1018,23 @@
 
 	if(!included) {
 	    if(!printinfected)
-		logg("%s: Excluded\n", filename);
-	    return 0;
+		logg("%s: Excluded\n", args->filename);
+	    if (max_threads > 0) pthread_exit(NULL); else return;
 	}
     }
 
-    if(fileinfo(filename, 1) == 0) {
+    if(fileinfo(args->filename, 1) == 0) {
 	if(!printinfected)
-	    logg("%s: Empty file\n", filename);
-	return 0;
+	    logg("%s: Empty file\n", args->filename);
+	if (max_threads > 0) pthread_exit(NULL); else return;
     }
 
 #ifndef C_WINDOWS
     if(geteuid())
-	if(checkaccess(filename, NULL, R_OK) != 1) {
+	if(checkaccess(args->filename, NULL, R_OK) != 1) {
 	    if(!printinfected)
-		logg("%s: Access denied\n", filename);
-	    return 0;
+		logg("%s: Access denied\n", args->filename);
+	    if (max_threads > 0) pthread_exit(NULL); else return;
 	}
 #endif
 
@@ -1013,45 +1047,45 @@
      * external (if provided) when internal cannot extract data.
      */
 
-    if((cli_strbcasestr(filename, ".zip") || cli_strbcasestr(filename, ".rar")) && (options & CL_SCAN_ARCHIVE)) {
+    if((cli_strbcasestr(args->filename, ".zip") || cli_strbcasestr(args->filename, ".rar")) && (args->options & CL_SCAN_ARCHIVE)) {
 	/* try to use internal archivers */
-	if((ret = checkfile(filename, engine, limits, options, 1)) == CL_VIRUS) {
-	    if(opt_check(opt, "remove")) {
-		if(unlink(filename)) {
-		    logg("^%s: Can't remove\n", filename);
+	if((ret = checkfile(args->filename, args->engine, args->limits, args->options, 1)) == CL_VIRUS) {
+	    if(opt_check(args->opt, "remove")) {
+		if(unlink(args->filename)) {
+		    logg("^%s: Can't remove\n", args->filename);
 		    info.notremoved++;
 		} else {
-		    logg("%s: Removed\n", filename);
+		    logg("%s: Removed\n", args->filename);
 		}
-	    } else if (opt_check(opt, "move") || opt_check(opt, "copy"))
-		move_infected(filename, opt);
+	    } else if (opt_check(args->opt, "move") || opt_check(args->opt, "copy"))
+		move_infected(args->filename, args->opt);
 
-	    return 1;
+	    if (max_threads > 0) pthread_exit(NULL); else return;
 
 	} else if(ret == CL_CLEAN) {
-	    return 0;
+	    if (max_threads > 0) pthread_exit(NULL); else return;
 	} else if(ret == 54) {
-	    return ret;
+	    if (max_threads > 0) pthread_exit(NULL); else return;
 	}
 
 	/* in other case try to continue with external archivers */
-	options &= ~CL_SCAN_ARCHIVE; /* and disable decompression for the checkfile() below */
+	args->options &= ~CL_SCAN_ARCHIVE; /* and disable decompression for the checkfile() below */
 	printclean = 0;
     }
 
-    if((cli_strbcasestr(filename, ".zip") && opt_check(opt, "unzip"))
-    || (cli_strbcasestr(filename, ".rar") && opt_check(opt, "unrar"))
-    || (cli_strbcasestr(filename, ".arj") && opt_check(opt, "arj"))
-    || (cli_strbcasestr(filename, ".zoo") && opt_check(opt, "unzoo"))
-    || (cli_strbcasestr(filename, ".jar") && opt_check(opt, "jar"))
-    || (cli_strbcasestr(filename, ".lzh") && opt_check(opt, "lha"))
-    || (cli_strbcasestr(filename, ".tar") && opt_check(opt, "tar"))
-    || (cli_strbcasestr(filename, ".deb") && opt_check(opt, "deb"))
-    || ((cli_strbcasestr(filename, ".tar.gz") || cli_strbcasestr(filename, ".tgz")) 
-	 && (opt_check(opt, "tgz") || opt_check(opt, "deb"))) ) {
+    if((cli_strbcasestr(args->filename, ".zip") && opt_check(args->opt, "unzip"))
+    || (cli_strbcasestr(args->filename, ".rar") && opt_check(args->opt, "unrar"))
+    || (cli_strbcasestr(args->filename, ".arj") && opt_check(args->opt, "arj"))
+    || (cli_strbcasestr(args->filename, ".zoo") && opt_check(args->opt, "unzoo"))
+    || (cli_strbcasestr(args->filename, ".jar") && opt_check(args->opt, "jar"))
+    || (cli_strbcasestr(args->filename, ".lzh") && opt_check(args->opt, "lha"))
+    || (cli_strbcasestr(args->filename, ".tar") && opt_check(args->opt, "tar"))
+    || (cli_strbcasestr(args->filename, ".deb") && opt_check(args->opt, "deb"))
+    || ((cli_strbcasestr(args->filename, ".tar.gz") || cli_strbcasestr(args->filename, ".tgz")) 
+	 && (opt_check(args->opt, "tgz") || opt_check(args->opt, "deb"))) ) {
 
 	/* check permissions */
-	switch(checkaccess(filename, CLAMAVUSER, R_OK)) {
+	switch(checkaccess(args->filename, CLAMAVUSER, R_OK)) {
 	    case -1:
 		logg("^Can't get information about user "CLAMAVUSER"\n");
 		exit(60); /* this is a critical problem so we just exit here */
@@ -1061,34 +1095,75 @@
 	    case 0: /* read access denied */
 		if(geteuid()) {
 		    if(!printinfected)
-			logg("^%s: Access denied to archive\n", filename);
+			logg("^%s: Access denied to archive\n", args->filename);
 		} else {
 
-		    if(limits && limits->maxfilesize)
-			if((unsigned int) fileinfo(filename, 1) / 1024 > limits->maxfilesize) {
+		    if(args->limits && args->limits->maxfilesize)
+			if((unsigned int) fileinfo(args->filename, 1) / 1024 > args->limits->maxfilesize) {
 			    if(!printinfected)
-				logg("^%s: Archive too big\n", filename);
-			    return 0;
+				logg("^%s: Archive too big\n", args->filename);
+			    if (max_threads > 0) pthread_exit(NULL); else return;
 			}
 
-		    return(scandenied(filename, engine, user, opt, limits, options));
+		    scandenied(args->filename, args->engine, args->user, args->opt, args->limits, args->options);
+		    if (max_threads > 0) pthread_exit(NULL); else return;
 		}
-		return 0;
+		if (max_threads > 0) pthread_exit(NULL); else return;
 	    case 1:
-		return(scancompressed(filename, engine, user, opt, limits, options));
+		scancompressed(args->filename, args->engine, args->user, args->opt, args->limits, args->options);
+		if (max_threads > 0) pthread_exit(NULL); else return;
 	}
     }
 
-    if((ret = checkfile(filename, engine, limits, options, printclean)) == CL_VIRUS) {
-	if(opt_check(opt, "remove")) {
-	    if(unlink(filename)) {
-		logg("^%s: Can't remove\n", filename);
+    if((ret = checkfile(args->filename, args->engine, args->limits, args->options, printclean)) == CL_VIRUS) {
+	if(opt_check(args->opt, "remove")) {
+	    if(unlink(args->filename)) {
+		logg("^%s: Can't remove\n", args->filename);
 		info.notremoved++;
 	    } else {
-		logg("%s: Removed\n", filename);
+		logg("%s: Removed\n", args->filename);
 	    }
-	} else if (opt_check(opt, "move") || opt_check(opt, "copy"))
-            move_infected(filename, opt);
+	} else if (opt_check(args->opt, "move") || opt_check(args->opt, "copy"))
+            move_infected(args->filename, args->opt);
     }
-    return ret;
+
+    if (max_threads > 0) pthread_exit(NULL); else return;
+}
+
+int scanfile(const char *filename, struct cl_engine *engine, const struct passwd *user, const struct optstruct *opt, const struct cl_limits *limits, unsigned int options)
+{
+    
+    struct scanfile_args *args = calloc(sizeof(struct scanfile_args), 1);
+    
+    args->filename = malloc(strlen(filename) + 1);
+
+    strcpy(args->filename, filename);
+    args->engine = engine;
+    args->user = user;
+    args->opt = opt;
+    args->limits = limits;
+    args->options = options;
+
+    if (max_threads == 0) {
+	scanfile_org(args);
+    }
+    else {
+	if (threads_cnt < max_threads) {
+	
+	    pthread_create(&threads[thread_nr], NULL, scanfile_org, args);	    
+	    thread_nr++;
+	    threads_cnt++;
+	} else {
+	
+	    pthread_join(threads[thread_nr], NULL);
+	    pthread_create(&threads[thread_nr], NULL, scanfile_org, args);
+	    thread_nr++;
+	}
+    }
+ 
+    if (thread_nr == max_threads)
+	thread_nr = 0;
+
+    return 0;
 }
+
diff -Naur clamav-org/clamscan/manager.h clamav-my/clamscan/manager.h
--- clamav-org/clamscan/manager.h	2007-03-31 22:31:04.000000000 +0200
+++ clamav-my/clamscan/manager.h	2007-08-21 19:59:17.000000000 +0200
@@ -30,6 +30,16 @@
 #include "libclamav/clamav.h"
 #include "shared/options.h"
 
+struct scanfile_args{
+
+    char *filename;
+    struct cl_engine *engine;
+    struct passwd *user;
+    struct optstruct *opt;
+    struct cl_limits *limits;
+    unsigned int options;
+};
+
 int scanmanager(const struct optstruct *opt);
 
 int scanfile(const char *filename, struct cl_engine *engine, const struct passwd *user, const struct optstruct *opt, const struct cl_limits *limits, unsigned int options);
diff -Naur clamav-org/libclamav/aspack.c clamav-my/libclamav/aspack.c
--- clamav-org/libclamav/aspack.c	2007-07-12 02:38:51.000000000 +0200
+++ clamav-my/libclamav/aspack.c	2007-08-21 12:25:42.000000000 +0200
@@ -109,8 +109,8 @@
   uint32_t *d3 = stream->decarray3[which];
   uint32_t *d4 = stream->decarray4[which];
 
-  memset(bus,0,sizeof(bus));
-  memset(dict,0,sizeof(dict));
+  bzero(bus,sizeof(bus));
+  bzero(dict,sizeof(dict));
 
   for (i = 0; i < stream->dict_helper[which].size; i++) {
     /* within bounds - see comments in build_decrypt_dictionaries */
@@ -179,7 +179,7 @@
   uint32_t ret;
   int oob;
 
-  if (!getbits(stream, 1, &oob)) memset(stream->decrypt_dict, 0, 0x2f5);
+  if (!getbits(stream, 1, &oob)) bzero(stream->decrypt_dict, 0x2f5);
   if (oob) return 0;
 
   for (counter = 0; counter < 19; counter++) {
@@ -308,9 +308,9 @@
 
 
 static int decomp_block(struct ASPK *stream, uint32_t size, uint8_t *stuff, uint8_t *output) {
-  memset(stream->decarray3,0,sizeof(stream->decarray3));
-  memset(stream->decarray4,0,sizeof(stream->decarray4));
-  memset(stream->decrypt_dict, 0, 757);
+  bzero(stream->decarray3,sizeof(stream->decarray3));
+  bzero(stream->decarray4,sizeof(stream->decarray4));
+  bzero(stream->decrypt_dict, 757);
   stream->bitpos = 0x20;
   if (!build_decrypt_dictionaries(stream)) return 0;
   return decrypt(stream, stuff, size, output);
@@ -347,8 +347,8 @@
     j += ( 1 << image[ep+i+0x70e]); /* boundchecked in pe.c */
   }
 
-  memset(stream.array1,0,sizeof(stream.array1));
-  memset(stream.array2,0,sizeof(stream.array2));
+  bzero(stream.array1,sizeof(stream.array1));
+  bzero(stream.array2,sizeof(stream.array2));
 
   i=0;
   while (CLI_ISCONTAINED(image, size, blocks, 8) && (block_rva = cli_readint32(blocks)) && (block_size = cli_readint32(blocks+4)) && CLI_ISCONTAINED(image, size, image+block_rva, block_size)) {
diff -Naur clamav-org/libclamav/cab.c clamav-my/libclamav/cab.c
--- clamav-org/libclamav/cab.c	2007-07-11 00:01:30.000000000 +0200
+++ clamav-my/libclamav/cab.c	2007-08-21 12:20:04.000000000 +0200
@@ -210,7 +210,7 @@
     }
     rsize = sb.st_size;
 
-    memset(cab, 0, sizeof(struct cab_archive));
+    bzero(cab, sizeof(struct cab_archive));
 
     cab->length = EC32(hdr.cbCabinet);
     cli_dbgmsg("CAB: Cabinet length: %u\n", cab->length);
@@ -640,7 +640,7 @@
 		((struct mszip_stream *) file->state->stream)->wflag = 1;
 		if(ret < 0) {
 		    mszip_free(file->state->stream);
-		    memset(file->state, 0, sizeof(struct cab_state));
+		    bzero(file->state, sizeof(struct cab_state));
 		    file->state->stream = (struct mszip_stream *) mszip_init(file->fd, file->ofd, 4096, 1, file, &cab_read);
 		    if(!file->state->stream) {
 			free(file->state);
@@ -685,7 +685,7 @@
 		((struct lzx_stream *) file->state->stream)->wflag = 1;
 		if(ret < 0) {
 		    lzx_free(file->state->stream);
-		    memset(file->state, 0, sizeof(struct cab_state));
+		    bzero(file->state, sizeof(struct cab_state));
 		    file->state->stream = (struct lzx_stream *) lzx_init(file->fd, file->ofd, (int) (file->folder->cmethod >> 8) & 0x1f, 0, 4096, 0, file, &cab_read);
 		    if(!file->state->stream) {
 			free(file->state);
diff -Naur clamav-org/libclamav/dsig.c clamav-my/libclamav/dsig.c
--- clamav-org/libclamav/dsig.c	2007-03-31 22:31:04.000000000 +0200
+++ clamav-my/libclamav/dsig.c	2007-08-21 12:19:32.000000000 +0200
@@ -198,7 +198,7 @@
 	return CL_EDSIG;
     }
 
-    memset(fblock, 0, 8);
+    bzero(fblock, 8);
     memcpy(&fblock[8], sha256, hlen);
     memcpy(&fblock[8 + hlen], salt, slen);
 
diff -Naur clamav-org/libclamav/filetypes.c clamav-my/libclamav/filetypes.c
--- clamav-org/libclamav/filetypes.c	2007-07-11 12:14:08.000000000 +0200
+++ clamav-my/libclamav/filetypes.c	2007-08-21 12:18:55.000000000 +0200
@@ -259,7 +259,7 @@
 	struct cli_ac_data mdata;
 
 
-    memset(smallbuff, 0, sizeof(smallbuff));
+    bzero(smallbuff, sizeof(smallbuff));
     if((bread = read(desc, smallbuff, MAGIC_BUFFER_SIZE)) > 0)
 	ret = cli_filetype(smallbuff, bread);
 
diff -Naur clamav-org/libclamav/hashtab.c clamav-my/libclamav/hashtab.c
--- clamav-org/libclamav/hashtab.c	2007-06-30 13:50:56.000000000 +0200
+++ clamav-my/libclamav/hashtab.c	2007-08-21 12:18:27.000000000 +0200
@@ -63,7 +63,7 @@
 
 static inline void PROFILE_INIT(struct hashtable *s)
 {
-	memset(&s->PROFILE_STRUCT,0,sizeof(s->PROFILE_STRUCT));
+	bzero(&s->PROFILE_STRUCT,sizeof(s->PROFILE_STRUCT));
 }
 
 static inline void PROFILE_CALC_HASH(struct hashtable *s)
@@ -358,7 +358,7 @@
 		if(s->htable[i].key && s->htable[i].key != DELETED_KEY)
 			free(s->htable[i].key);/*FIXME: shut up warnings */
 	}
-	memset(s->htable, 0, s->capacity);
+	bzero(s->htable, s->capacity);
 	s->used = 0;
 }
 
diff -Naur clamav-org/libclamav/lockdb.c clamav-my/libclamav/lockdb.c
--- clamav-org/libclamav/lockdb.c	2007-03-09 22:56:27.000000000 +0100
+++ clamav-my/libclamav/lockdb.c	2007-08-21 12:17:57.000000000 +0200
@@ -160,7 +160,7 @@
 	return CL_ELOCKDB;
     }
 #ifndef C_WINDOWS
-    memset(&fl, 0, sizeof(fl));
+    bzero(&fl, sizeof(fl));
     fl.l_type = F_UNLCK;
     if(fcntl(lock->lock_fd, F_SETLK, &fl) == -1) {
 #else
@@ -264,7 +264,7 @@
     pthread_mutex_unlock(&lock_mutex);
 
 #ifndef C_WINDOWS
-    memset(&fl, 0, sizeof(fl));
+    bzero(&fl, sizeof(fl));
     fl.l_type = (writelock ? F_WRLCK : F_RDLCK);
     if(fcntl(lock->lock_fd, ((wait) ? F_SETLKW : F_SETLK), &fl) == -1) {
 #ifndef C_WINDOWS
diff -Naur clamav-org/libclamav/matcher-ac.c clamav-my/libclamav/matcher-ac.c
--- clamav-org/libclamav/matcher-ac.c	2007-08-06 14:05:42.000000000 +0200
+++ clamav-my/libclamav/matcher-ac.c	2007-08-21 12:17:28.000000000 +0200
@@ -450,7 +450,7 @@
 	return CL_ENULLARG;
     }
 
-    memset(&info, 0, sizeof(info));
+    bzero(&info, sizeof(info));
     current = root->ac_root;
 
     for(i = 0; i < length; i++)  {
diff -Naur clamav-org/libclamav/matcher-bm.c clamav-my/libclamav/matcher-bm.c
--- clamav-org/libclamav/matcher-bm.c	2007-03-31 22:31:04.000000000 +0200
+++ clamav-my/libclamav/matcher-bm.c	2007-08-21 12:16:34.000000000 +0200
@@ -151,7 +151,7 @@
     if(length < BM_MIN_LENGTH)
 	return CL_CLEAN;
 
-    memset(&info, 0, sizeof(info));
+    bzero(&info, sizeof(info));
 
     for(i = BM_MIN_LENGTH - BM_BLOCK_SIZE; i < length - BM_BLOCK_SIZE + 1; ) {
 	idx = HASH(buffer[i], buffer[i + 1], buffer[i + 2]);
diff -Naur clamav-org/libclamav/matcher-ncore.c clamav-my/libclamav/matcher-ncore.c
--- clamav-org/libclamav/matcher-ncore.c	2007-03-31 22:31:04.000000000 +0200
+++ clamav-my/libclamav/matcher-ncore.c	2007-08-21 12:16:12.000000000 +0200
@@ -364,7 +364,7 @@
         return CL_ENCIO;
     }
 
-    memset(&info, 0, sizeof(info));
+    bzero(&info, sizeof(info));
 
     /* Iterate over the list of results */
     count = (*sn_sigscan_resultcount_f)(resulthandle);
diff -Naur clamav-org/libclamav/mbox.c clamav-my/libclamav/mbox.c
--- clamav-org/libclamav/mbox.c	2007-07-11 12:16:30.000000000 +0200
+++ clamav-my/libclamav/mbox.c	2007-08-21 12:15:48.000000000 +0200
@@ -4191,7 +4191,7 @@
 	}
 	*ptr = '\0';
 
-	memset((char *)&server, '\0', sizeof(struct sockaddr_in));
+	bzero((char *)&server, sizeof(struct sockaddr_in));
 	server.sin_family = AF_INET;
 	server.sin_port = (in_port_t)htons(port);
 
diff -Naur clamav-org/libclamav/md5.c clamav-my/libclamav/md5.c
--- clamav-org/libclamav/md5.c	2007-02-12 11:47:01.000000000 +0100
+++ clamav-my/libclamav/md5.c	2007-08-21 12:15:27.000000000 +0200
@@ -230,13 +230,13 @@
 	free = 64 - used;
 
 	if (free < 8) {
-		memset(&ctx->buffer[used], 0, free);
+		bzero(&ctx->buffer[used], free);
 		body(ctx, ctx->buffer, 64);
 		used = 0;
 		free = 64;
 	}
 
-	memset(&ctx->buffer[used], 0, free - 8);
+	bzero(&ctx->buffer[used], free - 8);
 
 	ctx->lo <<= 3;
 	ctx->buffer[56] = ctx->lo;
@@ -267,5 +267,5 @@
 	result[14] = ctx->d >> 16;
 	result[15] = ctx->d >> 24;
 
-	memset(ctx, 0, sizeof(*ctx));
+	bzero(ctx, sizeof(*ctx));
 }
diff -Naur clamav-org/libclamav/message.c clamav-my/libclamav/message.c
--- clamav-org/libclamav/message.c	2007-03-11 20:49:37.000000000 +0100
+++ clamav-my/libclamav/message.c	2007-08-21 12:14:36.000000000 +0200
@@ -198,7 +198,7 @@
 		free(m->encodingTypes);
 	}
 
-	memset(m, '\0', sizeof(message));
+	bzero(m, sizeof(message));
 	m->mimeType = NOMIME;
 }
 
@@ -1775,7 +1775,7 @@
 		if(m->base64chars) {
 			unsigned char data[4];
 
-			memset(data, '\0', sizeof(data));
+			bzero(data, sizeof(data));
 			if(decode(m, NULL, data, base64, FALSE) && data[0]) {
 				if(first == NULL)
 					first = last = cli_malloc(sizeof(text));
diff -Naur clamav-org/libclamav/others.c clamav-my/libclamav/others.c
--- clamav-org/libclamav/others.c	2007-07-17 12:02:57.000000000 +0200
+++ clamav-my/libclamav/others.c	2007-08-21 12:14:03.000000000 +0200
@@ -883,7 +883,7 @@
 		return NULL;
 	}
 	bs->bitset = new_bitset;
-	memset(bs->bitset+bs->length, 0, new_length-bs->length);
+	bzero(bs->bitset+bs->length, new_length-bs->length);
 	bs->length = new_length;
 	return bs;
 }
diff -Naur clamav-org/libclamav/pe.c clamav-my/libclamav/pe.c
--- clamav-org/libclamav/pe.c	2007-06-19 17:09:20.000000000 +0200
+++ clamav-my/libclamav/pe.c	2007-08-21 12:13:41.000000000 +0200
@@ -2188,7 +2188,7 @@
     found = 2;
 
     lseek(desc, ep, SEEK_SET);
-    memset(buff, 0, sizeof(buff));
+    bzero(buff, sizeof(buff));
     if(cli_readn(desc, buff, 200) == -1) {
 	cli_dbgmsg("cli_readn() failed\n");
 	free(exe_sections);
diff -Naur clamav-org/libclamav/pst.c clamav-my/libclamav/pst.c
--- clamav-org/libclamav/pst.c	2007-04-02 19:49:01.000000000 +0200
+++ clamav-my/libclamav/pst.c	2007-08-21 12:12:21.000000000 +0200
@@ -706,7 +706,7 @@
 	    cli_errmsg("cannot be passed a NULL pst_file\n");
 	    return CL_ENULLARG;
 	}
-	memset(pf, 0, sizeof(pst_file));
+	bzero(pf, sizeof(pst_file));
 
 	i = dup(desc);
 #ifdef  C_CYGWIN
@@ -820,7 +820,7 @@
     if (ptr != NULL) {
 	struct holder h;
 
-	memset(&h, '\0', sizeof(struct holder));
+	bzero(&h, sizeof(struct holder));
 
 	h.fp = fp;
 	h.base64 = 1;
@@ -1778,7 +1778,7 @@
 
     _pst_getBlockOffset(buf, ind_ptr, block_hdr.offset, &block_offset);
     fr_ptr = block_offset.from; //now got pointer to "7C block"
-    memset(&seven_c_blk, 0, sizeof(seven_c_blk));
+//    memset(&seven_c_blk, 0, sizeof(seven_c_blk)); //This line is needless
     memcpy(&seven_c_blk, &(buf[fr_ptr]), sizeof(seven_c_blk));
     LE16_CPU(seven_c_blk.u1);
     LE16_CPU(seven_c_blk.u2);
@@ -2053,16 +2053,16 @@
 }
 
 // check if item->email is NULL, and init if so
-#define MALLOC_EMAIL(x) { if (x->email == NULL) { x->email = (pst_item_email*) cli_malloc(sizeof(pst_item_email)); memset (x->email, 0, sizeof(pst_item_email));} }
-#define MALLOC_FOLDER(x) { if (x->folder == NULL) { x->folder = (pst_item_folder*) cli_malloc(sizeof(pst_item_folder)); memset (x->folder, 0, sizeof(pst_item_folder));} }
-#define MALLOC_CONTACT(x) { if (x->contact == NULL) { x->contact = (pst_item_contact*) cli_malloc(sizeof(pst_item_contact)); memset(x->contact, 0, sizeof(pst_item_contact));} }
-#define MALLOC_MESSAGESTORE(x) { if (x->message_store == NULL) { x->message_store = (pst_item_message_store*) cli_malloc(sizeof(pst_item_message_store)); memset(x->message_store, 0, sizeof(pst_item_message_store)); } }
-#define MALLOC_JOURNAL(x) { if (x->journal == NULL) { x->journal = (pst_item_journal*) cli_malloc(sizeof(pst_item_journal)); memset(x->journal, 0, sizeof(pst_item_journal));} }
-#define MALLOC_APPOINTMENT(x) { if (x->appointment == NULL) { x->appointment = (pst_item_appointment*) cli_malloc(sizeof(pst_item_appointment)); memset(x->appointment, 0, sizeof(pst_item_appointment)); } }
+#define MALLOC_EMAIL(x) { if (x->email == NULL) { x->email = (pst_item_email*) cli_malloc(sizeof(pst_item_email)); bzero (x->email, sizeof(pst_item_email));} }
+#define MALLOC_FOLDER(x) { if (x->folder == NULL) { x->folder = (pst_item_folder*) cli_malloc(sizeof(pst_item_folder)); bzero (x->folder, sizeof(pst_item_folder));} }
+#define MALLOC_CONTACT(x) { if (x->contact == NULL) { x->contact = (pst_item_contact*) cli_malloc(sizeof(pst_item_contact)); bzero(x->contact, sizeof(pst_item_contact));} }
+#define MALLOC_MESSAGESTORE(x) { if (x->message_store == NULL) { x->message_store = (pst_item_message_store*) cli_malloc(sizeof(pst_item_message_store)); bzero(x->message_store, sizeof(pst_item_message_store)); } }
+#define MALLOC_JOURNAL(x) { if (x->journal == NULL) { x->journal = (pst_item_journal*) cli_malloc(sizeof(pst_item_journal)); bzero(x->journal, sizeof(pst_item_journal));} }
+#define MALLOC_APPOINTMENT(x) { if (x->appointment == NULL) { x->appointment = (pst_item_appointment*) cli_malloc(sizeof(pst_item_appointment)); bzero(x->appointment, sizeof(pst_item_appointment)); } }
 // malloc space and copy the current item's data -- plus one on the size for good luck (and string termination)
 #define LIST_COPY(targ, type) { \
   targ = type cli_realloc(targ, list->items[x]->size+1); \
-  memset(targ, 0, list->items[x]->size+1); \
+  bzero(targ, list->items[x]->size+1); \
   memcpy(targ, list->items[x]->data, list->items[x]->size); \
 }
 
@@ -2250,7 +2250,7 @@
 	cli_dbgmsg("Raw Subject - ");
 	MALLOC_EMAIL(item);
 	item->email->subject = (pst_item_email_subject*) cli_realloc(item->email->subject, sizeof(pst_item_email_subject));
-	memset(item->email->subject, 0, sizeof(pst_item_email_subject));
+	bzero(item->email->subject, sizeof(pst_item_email_subject));
 	cli_dbgmsg(" [size = %i] ", list->items[x]->size);
 	if (list->items[x]->size > 0) {
 	  if (isprint(list->items[x]->data[0])) {
@@ -2258,7 +2258,7 @@
 	    item->email->subject->off1 = 0;
 	    item->email->subject->off2 = 0;
 	    item->email->subject->subj = cli_realloc(item->email->subject->subj, list->items[x]->size+1);
-	    memset(item->email->subject->subj, 0, list->items[x]->size+1);
+	    bzero(item->email->subject->subj, list->items[x]->size+1);
 	    memcpy(item->email->subject->subj, list->items[x]->data, list->items[x]->size);
 	  } else {
 	    cli_dbgmsg("Raw Subject has control codes\n");
@@ -2266,7 +2266,7 @@
 	    item->email->subject->off1 = list->items[x]->data[0];
 	    item->email->subject->off2 = list->items[x]->data[1];
 	    item->email->subject->subj = cli_realloc(item->email->subject->subj, (list->items[x]->size-2)+1);
-	    memset(item->email->subject->subj, 0, list->items[x]->size-1);
+	    bzero(item->email->subject->subj[list->items[x]->size-2], 1);
 	    memcpy(item->email->subject->subj, &(list->items[x]->data[2]), list->items[x]->size-2);
 	  }
 	  cli_dbgmsg("%s\n", item->email->subject->subj);
@@ -4403,7 +4403,7 @@
 		return 0;
 	}
 
-	memset(&h, '\0', sizeof(struct holder));
+	bzero(&h, sizeof(struct holder));
 	h.buf = buf;
 
 	return _pst_ff_getID2data(pf, ptr, &h);
diff -Naur clamav-org/libclamav/rebuildpe.c clamav-my/libclamav/rebuildpe.c
--- clamav-org/libclamav/rebuildpe.c	2007-04-05 21:44:44.000000000 +0200
+++ clamav-my/libclamav/rebuildpe.c	2007-08-21 12:12:56.000000000 +0200
@@ -144,7 +144,7 @@
     fakepe->AddressOfEntryPoint = EC32(ep);
     fakepe->ImageBase = EC32(base);
     fakepe->SizeOfHeaders = EC32(rawbase);
-    memset(pefile+0x148, 0, 0x80);
+    bzero(pefile+0x148, 0x80);
     cli_writeint32(pefile+0x148+0x10, ResRva);
     cli_writeint32(pefile+0x148+0x14, ResSize);
     curpe = pefile+0x148+0x80;
diff -Naur clamav-org/libclamav/regex_list.c clamav-my/libclamav/regex_list.c
--- clamav-org/libclamav/regex_list.c	2007-06-30 13:50:56.000000000 +0200
+++ clamav-my/libclamav/regex_list.c	2007-08-21 11:54:36.000000000 +0200
@@ -591,7 +591,7 @@
 				} 
 
 				root = &matcher->root_hosts[matcher->root_hosts_cnt-1];
- 				memset(root, 0, sizeof(struct cli_matcher));
+ 				bzero(root, sizeof(struct cli_matcher));
 
 				cli_dbgmsg("regex_list: Initialising AC pattern matcher\n");
 				if((rc = cli_ac_init(root, AC_DEFAULT_MIN_DEPTH, AC_DEFAULT_MAX_DEPTH))) {
diff -Naur clamav-org/libclamav/rtf.c clamav-my/libclamav/rtf.c
--- clamav-org/libclamav/rtf.c	2007-06-30 13:50:56.000000000 +0200
+++ clamav-my/libclamav/rtf.c	2007-08-21 11:53:41.000000000 +0200
@@ -515,7 +515,7 @@
 
 	cli_dbgmsg("in cli_scanrtf()\n");
 
-	memset(main_symbols, 0, 256);
+	bzero(main_symbols, 256);
 	main_symbols['{']=1;
 	main_symbols['}']=1;
 	main_symbols['\\']=1;
diff -Naur clamav-org/libclamav/scanners.c clamav-my/libclamav/scanners.c
--- clamav-org/libclamav/scanners.c	2007-07-16 17:58:54.000000000 +0200
+++ clamav-my/libclamav/scanners.c	2007-08-21 11:53:08.000000000 +0200
@@ -1936,7 +1936,7 @@
 		    case CL_TYPE_MSEXE:
 			if(SCAN_PE && ctx->dconf->pe && fpt->offset) {
 			    cli_dbgmsg("PE signature found at %u\n", (unsigned int) fpt->offset);
-			    memset(&peinfo, 0, sizeof(struct cli_exe_info));
+			    bzero(&peinfo, sizeof(struct cli_exe_info));
 			    peinfo.offset = fpt->offset;
 			    lseek(desc, fpt->offset, SEEK_SET);
 			    if(cli_peheader(desc, &peinfo) == 0) {
@@ -2253,7 +2253,7 @@
     cli_ctx ctx;
     int rc;
 
-    memset(&ctx, '\0', sizeof(cli_ctx));
+    bzero(&ctx, sizeof(cli_ctx));
     ctx.engine = engine;
     ctx.virname = virname;
     ctx.limits = limits;
diff -Naur clamav-org/libclamav/spin.c clamav-my/libclamav/spin.c
--- clamav-org/libclamav/spin.c	2007-07-12 02:38:51.000000000 +0200
+++ clamav-my/libclamav/spin.c	2007-08-21 11:52:37.000000000 +0200
@@ -399,7 +399,7 @@
 	 break;
        }
        blobsz+=sections[j].vsz;
-       memset(sects[j], 0, sections[j].vsz);
+       bzero(sects[j], sections[j].vsz);
        cli_dbgmsg("spin: Growing sect%d: was %x will be %x\n", j, sections[j].rsz, sections[j].vsz);
        if ( cli_unfsg(src + sections[j].raw, sects[j], sections[j].rsz, sections[j].vsz, NULL, NULL) == -1 ) {
 	 len++;
@@ -441,7 +441,7 @@
 
       if ( (curr=(char *)cli_malloc(sections[j].vsz)) != NULL ) {
 	memcpy(curr, src + sections[j].raw, key32 - sections[j].rva); /* Uncompressed part */
-	memset(curr + key32 - sections[j].rva, 0, sections[j].vsz - (key32 - sections[j].rva)); /* bzero */
+	bzero(curr + key32 - sections[j].rva, sections[j].vsz - (key32 - sections[j].rva)); /* bzero */
 	if ( cli_unfsg(src + sections[j].raw + key32 - sections[j].rva, curr + key32 - sections[j].rva, sections[j].rsz - (key32 - sections[j].rva), sections[j].vsz - (key32 - sections[j].rva), NULL, NULL) ) {
       
 	  free(curr);
diff -Naur clamav-org/libclamav/suecrypt.c clamav-my/libclamav/suecrypt.c
--- clamav-org/libclamav/suecrypt.c	2007-04-05 21:44:44.000000000 +0200
+++ clamav-my/libclamav/suecrypt.c	2007-08-21 11:51:59.000000000 +0200
@@ -124,7 +124,7 @@
   hunk[7]=sects>>8;
   cli_writeint32(hunk+0x28, va);
   hunk+=0x18+(cli_readint32(hunk+0x14)&0xffff); /* size of PE + size of OPT */
-  memset(hunk+0x28*sects, 0, 0x28);
+  bzero(hunk+0x28*sects, 0x28);
 
   return file;
 }
diff -Naur clamav-org/libclamav/unzip.c clamav-my/libclamav/unzip.c
--- clamav-org/libclamav/unzip.c	2007-03-31 22:31:04.000000000 +0200
+++ clamav-my/libclamav/unzip.c	2007-08-21 11:51:34.000000000 +0200
@@ -418,7 +418,7 @@
 	    free(fp->buf32k);
     }
 
-    memset(fp, 0, sizeof(zip_file)); 
+    bzero(fp, sizeof(zip_file)); 
 
     if(!dir->cache.fp)
 	dir->cache.fp = fp;
@@ -436,7 +436,7 @@
 
 
     if(fp->method) {
-        memset(&fp->d_stream, 0, sizeof(fp->d_stream));
+        bzero(&fp->d_stream, sizeof(fp->d_stream));
 
         ret = inflateInit2(&fp->d_stream, -MAX_WBITS);
 
diff -Naur clamav-org/libclamav/wwunpack.c clamav-my/libclamav/wwunpack.c
--- clamav-org/libclamav/wwunpack.c	2007-04-05 21:44:44.000000000 +0200
+++ clamav-my/libclamav/wwunpack.c	2007-08-21 11:51:01.000000000 +0200
@@ -355,7 +355,7 @@
     cli_writeint32(stuff+20, cli_readint32(stuff+12)-min+headsize);
     stuff+=0x28;
   }
-  memset(stuff, 0, 0x28);
+  bzero(stuff, 0x28);
 
   return 0;
 }
diff -Naur clamav-org/libclamav/yc.c clamav-my/libclamav/yc.c
--- clamav-org/libclamav/yc.c	2007-07-12 02:38:51.000000000 +0200
+++ clamav-my/libclamav/yc.c	2007-08-21 11:50:40.000000000 +0200
@@ -221,7 +221,7 @@
   pe->NumberOfSections=EC16(sectcount);
 
   /* Remove IMPORT_DIRECTORY information */
-  memset((char *)pe + sizeof(struct pe_image_file_hdr) + 0x68, 0, 8);
+  bzero((char *)pe + sizeof(struct pe_image_file_hdr) + 0x68, 8);
 
   /* OEP resolving */
   /* OEP = DWORD PTR [ Start of yC section+ A0F] */
diff -Naur clamav-org/target.h clamav-my/target.h
--- clamav-org/target.h	2007-08-21 11:48:39.000000000 +0200
+++ clamav-my/target.h	2007-08-21 19:46:03.000000000 +0200
@@ -1,5 +1,5 @@
 /* automatically generated by configure */
-/* on Tue Aug 21 11:48:39 CEST 2007 */
+/* on Tue Aug 21 19:46:03 CEST 2007 */
 /* target uppercase defines */
  
 #ifndef TARGET_OS_LINUX_GNU
