[Pkg-clamav-commits] [SCM] Debian repository for ClamAV branch, debian/unstable, updated. debian/0.95+dfsg-1-6156-g094ec9b

aCaB acab at clamav.net
Sun Apr 4 01:05:42 UTC 2010


The following commit has been merged in the debian/unstable branch:
commit 58481352d5b2128b53943614dbc9abe5999069d9
Author: aCaB <acab at clamav.net>
Date:   Thu Sep 24 19:07:39 2009 +0200

    win32 paths handling

diff --git a/ChangeLog b/ChangeLog
index b7ac171..ae27be9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Thu Sep 24 19:05:06 CEST 2009 (acab)
+------------------------------------
+ * win32 paths handling
+
 Thu Sep 24 16:22:25 CEST 2009 (acab)
 ------------------------------------
  * merge initial set of win32 patches from Gianluigi Tiesi <sherpya*netfarm.it>
diff --git a/clamav-milter/clamav-milter.c b/clamav-milter/clamav-milter.c
index d6d80e0..cc28fc3 100644
--- a/clamav-milter/clamav-milter.c
+++ b/clamav-milter/clamav-milter.c
@@ -162,7 +162,7 @@ int main(int argc, char **argv) {
 
     if((opt = optget(opts, "LogFile"))->enabled) {
 	logg_file = opt->strarg;
-	if(strlen(logg_file) < 2 || logg_file[0] != '/') {
+	if(!cli_is_abspath(logg_file)) {
 	    fprintf(stderr, "ERROR: LogFile requires full path.\n");
 	    logg_close();
 	    optfree(opts);
diff --git a/clamav-milter/connpool.c b/clamav-milter/connpool.c
index 1af1525..0de3a62 100644
--- a/clamav-milter/connpool.c
+++ b/clamav-milter/connpool.c
@@ -59,7 +59,7 @@ static int cpool_addunix(char *path) {
     struct sockaddr_un *srv;
     struct CP_ENTRY *cpe = &cp->pool[cp->entries-1];
 
-    if(strlen(path)<2 || *path!='/') {
+    if(!cli_is_abspath(path)) {
 	logg("!Unix clamd socket must be an absolute path\n");
 	return 1;
     }
diff --git a/clamav-milter/netcode.c b/clamav-milter/netcode.c
index 7624cf4..c6b3d82 100644
--- a/clamav-milter/netcode.c
+++ b/clamav-milter/netcode.c
@@ -486,7 +486,7 @@ int localnets_init(struct optstruct *opts) {
 	while(opt) {
 	    char *lnetname = opt->strarg;
 	    struct LOCALNET *l;
-	    char *mask = strrchr(lnetname, '/');
+	    char *mask = strrchr(lnetname, *PATHSEP);
 
 	    if(mask) {
 		*mask='\0';
diff --git a/clamconf/clamconf.c b/clamconf/clamconf.c
index a1ade4d..7f8be3c 100644
--- a/clamconf/clamconf.c
+++ b/clamconf/clamconf.c
@@ -237,7 +237,7 @@ int main(int argc, char **argv)
     dir = optget(opts, "config-dir")->strarg;
     printf("Checking configuration files in %s\n", dir);
     for(i = 0; cfgfile[i].name; i++) {
-	snprintf(path, sizeof(path), "%s/%s", dir, cfgfile[i].name);
+	snprintf(path, sizeof(path), "%s"PATHSEP"%s", dir, cfgfile[i].name);
 	path[511] = 0;
 	if(access(path, R_OK)) {
 	    printf("\n%s not found\n", cfgfile[i].name);
@@ -304,7 +304,7 @@ int main(int argc, char **argv)
     printf("Database directory: %s\n", dbdir);
     flevel = cl_retflevel();
     for(i = 0; dbnames[i]; i++) {
-	snprintf(path, sizeof(path), "%s/%s", dbdir, dbnames[i]);
+	snprintf(path, sizeof(path), "%s"PATHSEP"%s", dbdir, dbnames[i]);
 	path[511] = 0;
 	if(!access(path, R_OK)) {
 	    cvd = cl_cvdhead(path);
diff --git a/clamd/clamd.c b/clamd/clamd.c
index 59faeb7..b696489 100644
--- a/clamd/clamd.c
+++ b/clamd/clamd.c
@@ -210,7 +210,7 @@ int main(int argc, char **argv)
     if((opt = optget(opts, "LogFile"))->enabled) {
 	char timestr[32];
 	logg_file = opt->strarg;
-	if(strlen(logg_file) < 2 || (logg_file[0] != '/' && logg_file[0] != '\\' && logg_file[1] != ':')) {
+	if(!cli_is_abspath(logg_file)) {
 	    fprintf(stderr, "ERROR: LogFile requires full path.\n");
 	    ret = 1;
 	    break;
diff --git a/clamdscan/client.c b/clamdscan/client.c
index 937e946..002f3e9 100644
--- a/clamdscan/client.c
+++ b/clamdscan/client.c
@@ -130,14 +130,14 @@ static char *makeabs(const char *basepath) {
 	logg("^Can't make room for fullpath.\n");
 	return NULL;
     }
-    if(*basepath != '/') { /* FIXME: to be unified */
+    if(!cli_is_abspath(basepath)) {
 	if(!getcwd(ret, PATH_MAX)) {
 	    logg("^Can't get absolute pathname of current working directory.\n");
 	    free(ret);
 	    return NULL;
 	}
 	namelen = strlen(ret);
-	snprintf(&ret[namelen], PATH_MAX - namelen, "/%s", basepath);
+	snprintf(&ret[namelen], PATH_MAX - namelen, PATHSEP"%s", basepath);
     } else {
 	strncpy(ret, basepath, PATH_MAX);
     }
diff --git a/clamdtop/clamdtop.c b/clamdtop/clamdtop.c
index b075ff7..ff95cd6 100644
--- a/clamdtop/clamdtop.c
+++ b/clamdtop/clamdtop.c
@@ -510,7 +510,7 @@ static int make_connection_real(const char *soname, conn_t *conn)
 #ifdef _WIN32
     {
 #else
-	if(soname[0] == '/' || (access(soname, F_OK) == 0)) {
+	if(cli_is_abspath(soname) || (access(soname, F_OK) == 0)) {
 		struct sockaddr_un addr;
 		s = socket(AF_UNIX, SOCK_STREAM, 0);
 		if(s < 0) {
diff --git a/clamscan/manager.c b/clamscan/manager.c
index 5a0f273..11e31fd 100644
--- a/clamscan/manager.c
+++ b/clamscan/manager.c
@@ -210,10 +210,10 @@ static int scandirs(const char *dirname, struct cl_engine *engine, const struct
 		if(strcmp(dent->d_name, ".") && strcmp(dent->d_name, "..")) {
 		    /* build the full name */
 		    fname = malloc(strlen(dirname) + strlen(dent->d_name) + 2);
-		    if(!strcmp(dirname, "/"))
-			sprintf(fname, "/%s", dent->d_name);
+		    if(!strcmp(dirname, PATHSEP))
+			sprintf(fname, PATHSEP"%s", dent->d_name);
 		    else
-			sprintf(fname, "%s/%s", dirname, dent->d_name);
+			sprintf(fname, "%s"PATHSEP"%s", dirname, dent->d_name);
 
 		    /* stat the file */
 		    if(lstat(fname, &statbuf) != -1) {
@@ -597,7 +597,7 @@ int scanmanager(const struct optstruct *opts)
 		ret = 56;
 	    } else {
 		for(i = strlen(file) - 1; i > 0; i--) {
-		    if(file[i] == '/')
+		    if(file[i] == *PATHSEP)
 			file[i] = 0;
 		    else
 			break;
diff --git a/libclamav/autoit.c b/libclamav/autoit.c
index 78bf62d..94cacc1 100644
--- a/libclamav/autoit.c
+++ b/libclamav/autoit.c
@@ -349,7 +349,7 @@ static int ea05(int desc, cli_ctx *ctx, char *tmpd) {
     /* FIXME: REGRESSION NEEDED! */
     /* UNP.usize = u2a(UNP.outputbuf, UNP.usize); */
 
-    snprintf(tempfile, 1023, "%s/autoit.%.3u", tmpd, files);
+    snprintf(tempfile, 1023, "%s"PATHSEP"autoit.%.3u", tmpd, files);
     tempfile[1023]='\0';
     if((i = open(tempfile, O_RDWR|O_CREAT|O_TRUNC|O_BINARY, S_IRWXU)) < 0) {
       cli_dbgmsg("autoit: Can't create file %s\n", tempfile);
@@ -859,7 +859,7 @@ static int ea06(int desc, cli_ctx *ctx, char *tmpd) {
       UNP.cur_output = UNP.usize ;
     }
 
-    snprintf(tempfile, 1023, "%s/autoit.%.3u", tmpd, files);
+    snprintf(tempfile, 1023, "%s"PATHSEP"autoit.%.3u", tmpd, files);
     tempfile[1023]='\0';
     if((i = open(tempfile, O_RDWR|O_CREAT|O_TRUNC|O_BINARY, S_IRWXU)) < 0) {
       cli_dbgmsg("autoit: Can't create file %s\n", tempfile);
diff --git a/libclamav/blob.c b/libclamav/blob.c
index 49e2644..2184eee 100644
--- a/libclamav/blob.c
+++ b/libclamav/blob.c
@@ -666,21 +666,9 @@ fileblobInfected(const fileblob *fb)
 void
 sanitiseName(char *name)
 {
-	while(*name) {
-#ifdef	C_DARWIN
-		*name &= '\177';
-#endif
-#if	defined(MSDOS) || defined(C_OS2)
-		/*
-		 * Don't take it from this that ClamAV supports DOS, it doesn't
-		 * I don't know if spaces are legal in OS/2.
-		 */
-		if(strchr("%/*?<>|\\\"+=,;:\t ~", *name))
-#elif defined(_WIN32)
-		if(strchr("%/*?<>|\\\"+=,;:\t~", *name))
-#else
-		if(*name == '/')
-#endif
+	char c;
+	while((c = *name)) {
+		if(c!='.' && c!='_' && (c>'z' || c<'0' || (c>'9' && c<'A') || (c>'Z' && c<'a')))
 			*name = '_';
 		name++;
 	}
diff --git a/libclamav/chmunpack.c b/libclamav/chmunpack.c
index 5c4d9f1..b234185 100644
--- a/libclamav/chmunpack.c
+++ b/libclamav/chmunpack.c
@@ -689,7 +689,7 @@ static int chm_decompress_stream(int fd, chm_metadata_t *metadata, const char *d
 	char filename[1024];
 	struct cab_file file;
 	
-	snprintf(filename, 1024, "%s/clamav-unchm.bin", dirname);
+	snprintf(filename, 1024, "%s"PATHSEP"clamav-unchm.bin", dirname);
 	tmpfd = open(filename, O_RDWR|O_CREAT|O_TRUNC|O_BINARY, S_IRWXU);
 	if (tmpfd<0) {
 		cli_dbgmsg("open failed for %s\n", filename);
@@ -822,7 +822,7 @@ int cli_chm_extract_file(int fd, char *dirname, chm_metadata_t *metadata, cli_ct
 		cli_dbgmsg("seek in uncompressed stream failed\n");
 		return CL_EFORMAT;
 	}
-	snprintf(filename, 1024, "%s/%lu.chm", dirname, (unsigned long int) metadata->file_offset);
+	snprintf(filename, 1024, "%s"PATHSEP"%lu.chm", dirname, (unsigned long int) metadata->file_offset);
 	metadata->ofd = open(filename, O_RDWR|O_CREAT|O_TRUNC|O_BINARY, S_IRWXU);
 	if (metadata->ofd < 0) {
 		return CL_ECREAT;
diff --git a/libclamav/cvd.c b/libclamav/cvd.c
index 4e9bc79..a94fcc8 100644
--- a/libclamav/cvd.c
+++ b/libclamav/cvd.c
@@ -105,7 +105,7 @@ static int cli_untgz(int fd, const char *destdir)
 		return -1;
 	    }
 
-	    snprintf(path, pathlen, "%s/%s", destdir, name);
+	    snprintf(path, pathlen, "%s"PATHSEP"%s", destdir, name);
 	    cli_dbgmsg("cli_untgz: Unpacking %s\n", path);
 	    type = block[156];
 
diff --git a/libclamav/htmlnorm.c b/libclamav/htmlnorm.c
index 7646859..afbdff9 100644
--- a/libclamav/htmlnorm.c
+++ b/libclamav/htmlnorm.c
@@ -653,7 +653,7 @@ static int cli_html_normalise(int fd, m_area_t *m_area, const char *dirname, tag
 	tag_args.value = NULL;
 	tag_args.contents = NULL;
 	if (dirname) {
-		snprintf(filename, 1024, "%s/rfc2397", dirname);
+		snprintf(filename, 1024, "%s"PATHSEP"rfc2397", dirname);
 		if (mkdir(filename, 0700) && errno != EEXIST) {
 			file_buff_o2 = file_buff_text = NULL;
 			goto abort;
@@ -666,7 +666,7 @@ static int cli_html_normalise(int fd, m_area_t *m_area, const char *dirname, tag
 		}
 
 		/* this will still contains scripts that are inside comments */
-		snprintf(filename, 1024, "%s/nocomment.html", dirname);
+		snprintf(filename, 1024, "%s"PATHSEP"nocomment.html", dirname);
 		file_buff_o2->fd = open(filename, O_WRONLY|O_CREAT|O_TRUNC, S_IWUSR|S_IRUSR);
 		if (file_buff_o2->fd == -1) {
 			cli_dbgmsg("open failed: %s\n", filename);
@@ -683,7 +683,7 @@ static int cli_html_normalise(int fd, m_area_t *m_area, const char *dirname, tag
 			goto abort;
 		}
 
-		snprintf(filename, 1024, "%s/notags.html", dirname);
+		snprintf(filename, 1024, "%s"PATHSEP"notags.html", dirname);
 		file_buff_text->fd = open(filename, O_WRONLY|O_CREAT|O_TRUNC, S_IWUSR|S_IRUSR);
 		if(file_buff_text->fd == -1) {
 			cli_dbgmsg("open failed: %s\n", filename);
@@ -1482,7 +1482,7 @@ static int cli_html_normalise(int fd, m_area_t *m_area, const char *dirname, tag
 					if (!file_tmp_o1) {
 						goto abort;
 					}
-					snprintf(filename, 1024, "%s/rfc2397", dirname);
+					snprintf(filename, 1024, "%s"PATHSEP"rfc2397", dirname);
 					tmp_file = cli_gentemp(filename);
 					if(!tmp_file) {
 						goto abort;
@@ -1755,7 +1755,7 @@ int html_screnc_decode(int fd, const char *dirname)
 		return FALSE;
 	}
 
-	snprintf((char*)filename, 1024, "%s/screnc.html", dirname);
+	snprintf((char*)filename, 1024, "%s"PATHSEP"screnc.html", dirname);
 	ofd = open((const char*)filename, O_WRONLY|O_CREAT|O_TRUNC, S_IWUSR|S_IRUSR);
 
 	if (ofd < 0) {
diff --git a/libclamav/jsparse/js-norm.c b/libclamav/jsparse/js-norm.c
index 24cf297..15b3f80 100644
--- a/libclamav/jsparse/js-norm.c
+++ b/libclamav/jsparse/js-norm.c
@@ -897,7 +897,7 @@ void cli_js_output(struct parser_state *state, const char *tempdir)
 	char lastchar = '\0';
 	char filename[1024];
 
-	snprintf(filename, 1024, "%s/javascript", tempdir);
+	snprintf(filename, 1024, "%s"PATHSEP"javascript", tempdir);
 
 	buf.pos = 0;
 	buf.outfd = open(filename, O_CREAT | O_WRONLY, 0600);
diff --git a/libclamav/libclamav.map b/libclamav/libclamav.map
index 0654dbc..5a136a1 100644
--- a/libclamav/libclamav.map
+++ b/libclamav/libclamav.map
@@ -33,6 +33,7 @@ CLAMAV_PUBLIC {
 CLAMAV_PRIVATE {
   global:
     cli_gettmpdir;
+    cli_is_abspath;
     cli_strtok;
     cli_strtokenize;
     cli_cvdunpack;
diff --git a/libclamav/mbox.c b/libclamav/mbox.c
index 3f3c2a3..3f28cd6 100644
--- a/libclamav/mbox.c
+++ b/libclamav/mbox.c
@@ -3653,7 +3653,7 @@ rfc1341(message *m, const char *dir)
 
 	tmpdir = cli_gettmpdir();
 
-	snprintf(pdir, sizeof(pdir) - 1, "%s/clamav-partial", tmpdir);
+	snprintf(pdir, sizeof(pdir) - 1, "%s"PATHSEP"clamav-partial", tmpdir);
 
 	if((mkdir(pdir, S_IRWXU) < 0) && (errno != EEXIST)) {
 		cli_errmsg("Can't create the directory '%s'\n", pdir);
@@ -3737,7 +3737,7 @@ rfc1341(message *m, const char *dir)
 
 			sanitiseName(id);
 
-			snprintf(outname, sizeof(outname) - 1, "%s/%s", dir, id);
+			snprintf(outname, sizeof(outname) - 1, "%s"PATHSEP"%s", dir, id);
 
 			cli_dbgmsg("outname: %s\n", outname);
 
@@ -3784,7 +3784,7 @@ rfc1341(message *m, const char *dir)
 							!strcmp("..", dent->d_name))
 						continue;
 					snprintf(fullname, sizeof(fullname) - 1,
-						"%s/%s", pdir, dent->d_name);
+						"%s"PATHSEP"%s", pdir, dent->d_name);
 					dentry_idpart = strchr(dent->d_name, '_');
 
 					if(!dentry_idpart ||
diff --git a/libclamav/message.c b/libclamav/message.c
index a5030bf..a9366a8 100644
--- a/libclamav/message.c
+++ b/libclamav/message.c
@@ -1711,7 +1711,7 @@ int messageSavePartial(message *m, const char *dir, const char *md5id, unsigned
 
 	cli_dbgmsg("messageSavePartial\n");
 	time_val  = time(NULL);
-	snprintf(fullname, 1024, "%s/clamav-partial-%lu_%s-%u", dir, time_val, md5id, part);
+	snprintf(fullname, 1024, "%s"PATHSEP"clamav-partial-%lu_%s-%u", dir, time_val, md5id, part);
 
 	fb = messageExport(m, fullname,
 		(void *(*)(void))fileblobCreate,
diff --git a/libclamav/nsis/nulsft.c b/libclamav/nsis/nulsft.c
index f2d6ca5..f3b73ee 100644
--- a/libclamav/nsis/nulsft.c
+++ b/libclamav/nsis/nulsft.c
@@ -201,9 +201,9 @@ static int nsis_unpack_next(struct nsis_st *n, cli_ctx *ctx) {
     return ret;
 
   if (n->fno)
-    snprintf(n->ofn, 1023, "%s/content.%.3u", n->dir, n->fno);
+    snprintf(n->ofn, 1023, "%s"PATHSEP"content.%.3u", n->dir, n->fno);
   else
-    snprintf(n->ofn, 1023, "%s/headers", n->dir);
+    snprintf(n->ofn, 1023, "%s"PATHSEP"headers", n->dir);
 
   n->fno++;
 
diff --git a/libclamav/ole2_extract.c b/libclamav/ole2_extract.c
index d823c44..66c123a 100644
--- a/libclamav/ole2_extract.c
+++ b/libclamav/ole2_extract.c
@@ -534,7 +534,7 @@ static int ole2_walk_property_tree(int fd, ole2_header_t *hdr, const char *dir,
 			if (dir) {
 				dirname = (char *) cli_malloc(strlen(dir)+8);
 				if (!dirname) return CL_BREAK;
-				snprintf(dirname, strlen(dir)+8, "%s/%.6d", dir, prop_index);
+				snprintf(dirname, strlen(dir)+8, "%s"PATHSEP"%.6d", dir, prop_index);
 				if (mkdir(dirname, 0700) != 0) {
 					free(dirname);
 					return CL_BREAK;
@@ -580,7 +580,7 @@ static int handler_writefile(int fd, ole2_header_t *hdr, property_t *prop, const
 	name = get_property_name2(prop->name, prop->name_size);
 	if (name) cnt = uniq_add(hdr->U, name, strlen(name), &hash);
 	else cnt = uniq_add(hdr->U, NULL, 0, &hash);
-	snprintf(newname, sizeof(newname), "%s/%s_%u", dir, hash, cnt);
+	snprintf(newname, sizeof(newname), "%s"PATHSEP"%s_%u", dir, hash, cnt);
 	newname[sizeof(newname)-1]='\0';
 	cli_dbgmsg("OLE2 [handler_writefile]: Dumping '%s' to '%s'\n", name ? name : "<empty>", newname);
 	if (name) free(name);
diff --git a/libclamav/others.c b/libclamav/others.c
index bed7b03..8e2c288 100644
--- a/libclamav/others.c
+++ b/libclamav/others.c
@@ -778,7 +778,7 @@ int cli_rmdirs(const char *dirname)
 			    return -1;
 			}
 
-			sprintf(path, "%s/%s", dirname, dent->d_name);
+			sprintf(path, "%s"PATHSEP"%s", dirname, dent->d_name);
 
 			/* stat the file */
 			if(lstat(path, &statbuf) != -1) {
diff --git a/libclamav/others.h b/libclamav/others.h
index 09a48ce..76eab63 100644
--- a/libclamav/others.h
+++ b/libclamav/others.h
@@ -398,6 +398,7 @@ int cli_updatelimits(cli_ctx *, unsigned long);
 unsigned long cli_getsizelimit(cli_ctx *, unsigned long);
 int cli_matchregex(const char *str, const char *regex);
 void cli_qsort(void *basep, size_t nelems, size_t size, int (*comp)(const void *, const void *));
+int cli_is_abspath(const char *path);
 
 /* symlink behaviour */
 #define CLI_FTW_FOLLOW_FILE_SYMLINK 0x01
diff --git a/libclamav/others_common.c b/libclamav/others_common.c
index 52399c2..33f0c1f 100644
--- a/libclamav/others_common.c
+++ b/libclamav/others_common.c
@@ -364,12 +364,25 @@ int cli_filecopy(const char *src, const char *dest)
 #endif
 }
 
-#ifndef _WIN32
-static const char tmpdir[] = "/tmp";
+#ifndef P_tmpdir
+#ifdef _WIN32
+#define P_tmpdir "C:\\"
+#else
+#define P_tmpdir "/tmp"
+#endif /* _WIN32 */
+#endif /* P_tmpdir */
+
 const char *cli_gettmpdir(void) {
+	const char *tmpdir;
+    if(
+#ifdef _WIN32
+	!(tmpdir = getenv("TEMP")) && !(tmpdir = getenv("TMP"))
+#else
+	!(tmpdir = getenv("TMPDIR"))
+#endif
+    ) tmpdir = P_tmpdir;
     return tmpdir;
 }
-#endif /* _WIN32 */
 
 struct dirent_data {
     char *filename;
@@ -511,9 +524,9 @@ int cli_ftw(char *path, int flags, int maxdepth, cli_ftw_cb callback, struct cli
 	char *pathend;
 	/* trim slashes so that dir and dir/ behave the same when
 	 * they are symlinks, and we are not following symlinks */
-	while (path[0] == '/' && path[1] == '/') path++;
+	while (path[0] == *PATHSEP && path[1] == *PATHSEP) path++;
 	pathend = path + strlen(path);
-	while (pathend > path && pathend[-1] == '/') --pathend;
+	while (pathend > path && pathend[-1] == *PATHSEP) --pathend;
 	*pathend = '\0';
     }
     if(pathchk && pathchk(path, data) == 1)
@@ -606,10 +619,10 @@ static int cli_ftw_dir(const char *dirname, int flags, int maxdepth, cli_ftw_cb
 		if (ret != CL_SUCCESS)
 		    break;
 	    }
-            if(!strcmp(dirname, "/"))
-		sprintf(fname, "/%s", dent->d_name);
+            if(!strcmp(dirname, PATHSEP))
+		sprintf(fname, PATHSEP"%s", dent->d_name);
 	    else
-		sprintf(fname, "%s/%s", dirname, dent->d_name);
+		sprintf(fname, "%s"PATHSEP"%s", dirname, dent->d_name);
 
 	    if(pathchk && pathchk(fname, data) == 1) {
 		free(fname);
@@ -897,3 +910,13 @@ void cli_qsort(void *basep, size_t nelems, size_t size, int (*comp)(const void *
 	}
     }
 }
+
+int cli_is_abspath(const char *path) {
+#ifdef _WIN32
+    int len = strlen(path);
+    return (len > 2 && path[0] == '\\' && path[1] == '\\') || (len > 3 && path[1] == ':' && path[2] == '\\');
+#else
+    return strlen(path) > 1 && *path == '/';
+#endif
+}
+
diff --git a/libclamav/pdf.c b/libclamav/pdf.c
index d0b8331..e59316b 100644
--- a/libclamav/pdf.c
+++ b/libclamav/pdf.c
@@ -392,7 +392,7 @@ cli_pdf(const char *dir, int desc, cli_ctx *ctx, off_t offset)
 			has_cr = 1;
 		} else
 			has_cr = 0;
-		snprintf(fullname, sizeof(fullname), "%s/pdf%02u", dir, files);
+		snprintf(fullname, sizeof(fullname), "%s"PATHSEP"pdf%02u", dir, files);
 		fout = open(fullname, O_RDWR|O_CREAT|O_EXCL|O_TRUNC|O_BINARY, 0600);
 		if(fout < 0) {
 			char err[128];
diff --git a/libclamav/readdb.c b/libclamav/readdb.c
index 534f9f7..300a454 100644
--- a/libclamav/readdb.c
+++ b/libclamav/readdb.c
@@ -1547,7 +1547,7 @@ int cli_load(const char *filename, struct cl_engine *engine, unsigned int *signo
 	return CL_EOPEN;
     }
 
-    if((dbname = strrchr(filename, '/')))
+    if((dbname = strrchr(filename, *PATHSEP)))
 	dbname++;
     else
 	dbname = filename;
@@ -1668,35 +1668,35 @@ static int cli_loaddbdir(const char *dirname, struct cl_engine *engine, unsigned
 	return CL_EMEM;
 
     /* try to load local.ign and daily.cvd/daily.ign first */
-    sprintf(dbfile, "%s/local.ign", dirname);
+    sprintf(dbfile, "%s"PATHSEP"local.ign", dirname);
     if(!access(dbfile, R_OK) && (ret = cli_load(dbfile, engine, signo, options, NULL))) {
 	free(dbfile);
 	return ret;
     }
 
-    sprintf(dbfile, "%s/daily.cld", dirname);
+    sprintf(dbfile, "%s"PATHSEP"daily.cld", dirname);
     if(access(dbfile, R_OK))
-	sprintf(dbfile, "%s/daily.cvd", dirname);
+	sprintf(dbfile, "%s"PATHSEP"daily.cvd", dirname);
     if(!access(dbfile, R_OK) && (ret = cli_load(dbfile, engine, signo, options, NULL))) {
 	free(dbfile);
 	return ret;
     }
 
-    sprintf(dbfile, "%s/daily.ign", dirname);
+    sprintf(dbfile, "%s"PATHSEP"daily.ign", dirname);
     if(!access(dbfile, R_OK) && (ret = cli_load(dbfile, engine, signo, options, NULL))) {
 	free(dbfile);
 	return ret;
     }
 
     /* try to load local.gdb next */
-    sprintf(dbfile, "%s/local.gdb", dirname);
+    sprintf(dbfile, "%s"PATHSEP"local.gdb", dirname);
     if(!access(dbfile, R_OK) && (ret = cli_load(dbfile, engine, signo, options, NULL))) {
 	free(dbfile);
 	return ret;
     }
 
     /* check for and load daily.cfg */
-    sprintf(dbfile, "%s/daily.cfg", dirname);
+    sprintf(dbfile, "%s"PATHSEP"daily.cfg", dirname);
     if(!access(dbfile, R_OK) && (ret = cli_load(dbfile, engine, signo, options, NULL))) {
 	free(dbfile);
 	return ret;
@@ -1726,7 +1726,7 @@ static int cli_loaddbdir(const char *dirname, struct cl_engine *engine, unsigned
 		    closedir(dd);
 		    return CL_EMEM;
 		}
-		sprintf(dbfile, "%s/%s", dirname, dent->d_name);
+		sprintf(dbfile, "%s"PATHSEP"%s", dirname, dent->d_name);
 		ret = cli_load(dbfile, engine, signo, options, NULL);
 
 		if(ret) {
@@ -1858,7 +1858,7 @@ int cl_statinidir(const char *dirname, struct cl_stat *dbstat)
 		    closedir(dd);
 		    return CL_EMEM;
 		}
-		sprintf(fname, "%s/%s", dirname, dent->d_name);
+		sprintf(fname, "%s"PATHSEP"%s", dirname, dent->d_name);
 #if defined(C_INTERIX) || defined(C_OS2) || defined(_WIN32)
 		dbstat->statdname[dbstat->entries - 1] = (char *) cli_malloc(strlen(dent->d_name) + 1);
 		if(!dbstat->statdname[dbstat->entries - 1]) {
@@ -1922,7 +1922,7 @@ int cl_statchkdir(const struct cl_stat *dbstat)
 		    return CL_EMEM;
 		}
 
-		sprintf(fname, "%s/%s", dbstat->dir, dent->d_name);
+		sprintf(fname, "%s"PATHSEP"%s", dbstat->dir, dent->d_name);
 		stat(fname, &sb);
 		free(fname);
 
diff --git a/libclamav/scanners.c b/libclamav/scanners.c
index 60a8df8..f6d3d23 100644
--- a/libclamav/scanners.c
+++ b/libclamav/scanners.c
@@ -136,7 +136,7 @@ static int cli_scandir(const char *dirname, cli_ctx *ctx)
 			return CL_EMEM;
 		    }
 
-		    sprintf(fname, "%s/%s", dirname, dent->d_name);
+		    sprintf(fname, "%s"PATHSEP"%s", dirname, dent->d_name);
 
 		    /* stat the file */
 		    if(lstat(fname, &statbuf) != -1) {
@@ -752,7 +752,7 @@ static int cli_vba_scandir(const char *dirname, cli_ctx *ctx, struct uniq *U)
 
 	for(i = 0; i < vba_project->count; i++) {
 	    for(j = 0; (unsigned int)j < vba_project->colls[i]; j++) {
-		snprintf(vbaname, 1024, "%s/%s_%u", vba_project->dir, vba_project->name[i], j);
+		snprintf(vbaname, 1024, "%s"PATHSEP"%s_%u", vba_project->dir, vba_project->name[i], j);
 		vbaname[sizeof(vbaname)-1] = '\0';
 		fd = open(vbaname, O_RDONLY|O_BINARY);
 		if(fd == -1) continue;
@@ -786,7 +786,7 @@ static int cli_vba_scandir(const char *dirname, cli_ctx *ctx, struct uniq *U)
 
     if(ret == CL_CLEAN && (hashcnt = uniq_get(U, "powerpoint document", 19, &hash))) {
 	while(hashcnt--) {
-	    snprintf(vbaname, 1024, "%s/%s_%u", dirname, hash, hashcnt);
+	    snprintf(vbaname, 1024, "%s"PATHSEP"%s_%u", dirname, hash, hashcnt);
 	    vbaname[sizeof(vbaname)-1] = '\0';
 	    fd = open(vbaname, O_RDONLY|O_BINARY);
 	    if (fd == -1) continue;
@@ -804,7 +804,7 @@ static int cli_vba_scandir(const char *dirname, cli_ctx *ctx, struct uniq *U)
 
     if (ret == CL_CLEAN && (hashcnt = uniq_get(U, "worddocument", 12, &hash))) {
 	while(hashcnt--) {
-	    snprintf(vbaname, sizeof(vbaname), "%s/%s_%u", dirname, hash, hashcnt);
+	    snprintf(vbaname, sizeof(vbaname), "%s"PATHSEP"%s_%u", dirname, hash, hashcnt);
 	    vbaname[sizeof(vbaname)-1] = '\0';
 	    fd = open(vbaname, O_RDONLY|O_BINARY);
 	    if (fd == -1) continue;
@@ -851,7 +851,7 @@ static int cli_vba_scandir(const char *dirname, cli_ctx *ctx, struct uniq *U)
     /* Check directory for embedded OLE objects */
     hashcnt = uniq_get(U, "_1_ole10native", 14, &hash);
     while(hashcnt--) {
-	snprintf(vbaname, sizeof(vbaname), "%s/%s_%u", dirname, hash, hashcnt);
+	snprintf(vbaname, sizeof(vbaname), "%s"PATHSEP"%s_%u", dirname, hash, hashcnt);
 	vbaname[sizeof(vbaname)-1] = '\0';
 
 	fd = open(vbaname, O_RDONLY|O_BINARY);
@@ -885,7 +885,7 @@ static int cli_vba_scandir(const char *dirname, cli_ctx *ctx, struct uniq *U)
 			ret = CL_EMEM;
 			break;
 		    }
-		    sprintf(fullname, "%s/%s", dirname, dent->d_name);
+		    sprintf(fullname, "%s"PATHSEP"%s", dirname, dent->d_name);
 
 		    /* stat the file */
 		    if(lstat(fullname, &statbuf) != -1) {
@@ -943,7 +943,7 @@ static int cli_scanhtml(int desc, cli_ctx *ctx)
     cli_dbgmsg("cli_scanhtml: using tempdir %s\n", tempname);
 
     html_normalise_fd(desc, tempname, NULL, ctx->dconf);
-    snprintf(fullname, 1024, "%s/nocomment.html", tempname);
+    snprintf(fullname, 1024, "%s"PATHSEP"nocomment.html", tempname);
     fd = open(fullname, O_RDONLY|O_BINARY);
     if (fd >= 0) {
 	    ret = cli_scandesc(fd, ctx, CL_TYPE_HTML, 0, NULL, AC_SCAN_VIR);
@@ -953,7 +953,7 @@ static int cli_scanhtml(int desc, cli_ctx *ctx)
     if(ret == CL_CLEAN && sb.st_size < 2097152) {
 	    /* limit to 2 MB, we're not interesting in scanning large files in notags form */
 	    /* TODO: don't even create notags if file is over 2 MB */
-	    snprintf(fullname, 1024, "%s/notags.html", tempname);
+	    snprintf(fullname, 1024, "%s"PATHSEP"notags.html", tempname);
 	    fd = open(fullname, O_RDONLY|O_BINARY);
 	    if(fd >= 0) {
 		    ret = cli_scandesc(fd, ctx, CL_TYPE_HTML, 0, NULL, AC_SCAN_VIR);
@@ -962,7 +962,7 @@ static int cli_scanhtml(int desc, cli_ctx *ctx)
     }
 
     if(ret == CL_CLEAN) {
-	    snprintf(fullname, 1024, "%s/javascript", tempname);
+	    snprintf(fullname, 1024, "%s"PATHSEP"javascript", tempname);
 	    fd = open(fullname, O_RDONLY|O_BINARY);
 	    if(fd >= 0) {
 		    ret = cli_scandesc(fd, ctx, CL_TYPE_HTML, 0, NULL, AC_SCAN_VIR);
@@ -975,7 +975,7 @@ static int cli_scanhtml(int desc, cli_ctx *ctx)
     }
 
     if (ret == CL_CLEAN) {
-	snprintf(fullname, 1024, "%s/rfc2397", tempname);
+	snprintf(fullname, 1024, "%s"PATHSEP"rfc2397", tempname);
 	ret = cli_scandir(fullname, ctx);
     }
 
diff --git a/libclamav/sis.c b/libclamav/sis.c
index 49c1996..8bdf711 100644
--- a/libclamav/sis.c
+++ b/libclamav/sis.c
@@ -492,7 +492,7 @@ static int real_scansis(FILE *f, cli_ctx *ctx, const char *tmpd) {
 	    olen = lens[j];
 	    decomp = comp;
 	  }
-	  snprintf(ofn, 1024, "%s/sis%02d", tmpd, umped);
+	  snprintf(ofn, 1024, "%s"PATHSEP"sis%02d", tmpd, umped);
 	  ofn[1023]='\0';
 	  if ((fd=open(ofn, O_RDWR|O_CREAT|O_TRUNC|O_BINARY, 0600))==-1) {
 	    cli_errmsg("SIS: unable to create output file %s - aborting.", ofn);
@@ -709,7 +709,7 @@ static int real_scansis9x(FILE *f, cli_ctx *ctx, const char *tmpd) {
 	      if(getfield(s, &field) || field!=T_COMPRESSED || getd(s, &field) || getd(s, &usize) || getd(s, &usizeh) || usizeh) break;
 	      s->fsize[s->level]-=12;
 	      cli_dbgmsg("SIS: File is%s compressed - size %x -> %x\n", (field)?"":" not", s->fsize[s->level], usize);
-	      snprintf(tempf, 1024, "%s/sis9x%02d", tmpd, i++);
+	      snprintf(tempf, 1024, "%s"PATHSEP"sis9x%02d", tmpd, i++);
 	      tempf[1023]='\0';
 	      fseek(s->f, -(long)s->sleft, SEEK_CUR);
 	      s->sleft = s->smax = 0;
diff --git a/libclamav/unarj.c b/libclamav/unarj.c
index 65b9c87..7e510fd 100644
--- a/libclamav/unarj.c
+++ b/libclamav/unarj.c
@@ -1060,7 +1060,7 @@ int cli_unarj_extract_file(int fd, const char *dirname, arj_metadata_t *metadata
 		return CL_SUCCESS;
 	}
 	
-	snprintf(filename, 1024, "%s/file.uar", dirname);
+	snprintf(filename, 1024, "%s"PATHSEP"file.uar", dirname);
 	cli_dbgmsg("Filename: %s\n", filename);
 	metadata->ofd = open(filename, O_RDWR|O_CREAT|O_TRUNC|O_BINARY, 0600);
 	if (metadata->ofd < 0) {
diff --git a/libclamav/untar.c b/libclamav/untar.c
index 4432f99..ca3fa6d 100644
--- a/libclamav/untar.c
+++ b/libclamav/untar.c
@@ -180,7 +180,7 @@ cli_untar(const char *dir, int desc, unsigned int posix, cli_ctx *ctx)
 
 			strncpy(name, block, 100);
 			name[100] = '\0';
-			snprintf(fullname, sizeof(fullname)-1, "%s/tar%02u", dir, files);
+			snprintf(fullname, sizeof(fullname)-1, "%s"PATHSEP"tar%02u", dir, files);
 			fullname[sizeof(fullname)-1] = '\0';
 			fout = open(fullname, O_RDWR|O_CREAT|O_EXCL|O_TRUNC|O_BINARY, 0600);
 
diff --git a/libclamav/unzip.c b/libclamav/unzip.c
index 286bb85..5dbe1df 100644
--- a/libclamav/unzip.c
+++ b/libclamav/unzip.c
@@ -78,7 +78,7 @@ static int unz(uint8_t *src, uint32_t csize, uint32_t usize, uint16_t method, ui
   unsigned int res=1, written=0;
 
   if(tmpd) {
-    snprintf(name, sizeof(name), "%s/zip.%03u", tmpd, *fu);
+    snprintf(name, sizeof(name), "%s"PATHSEP"zip.%03u", tmpd, *fu);
     name[sizeof(name)-1]='\0';
   } else {
     if(!(tempfile = cli_gentemp(ctx->engine->tmpdir))) return CL_EMEM;
diff --git a/libclamav/vba_extract.c b/libclamav/vba_extract.c
index 0bebd84..b77046f 100644
--- a/libclamav/vba_extract.c
+++ b/libclamav/vba_extract.c
@@ -265,7 +265,7 @@ cli_vba_readdir(const char *dir, struct uniq *U, uint32_t which)
 	
 	if (!uniq_get(U, "_vba_project", 12, &hash))
 		return NULL;
-	snprintf(fullname, sizeof(fullname), "%s/%s_%u", dir, hash, which);
+	snprintf(fullname, sizeof(fullname), "%s"PATHSEP"%s_%u", dir, hash, which);
 	fullname[sizeof(fullname)-1] = '\0';
 	fd = open(fullname, O_RDONLY|O_BINARY);
 
@@ -653,7 +653,7 @@ ppt_unlzw(const char *dir, int fd, uint32_t length)
 	unsigned char inbuff[PPT_LZW_BUFFSIZE], outbuff[PPT_LZW_BUFFSIZE];
 	char fullname[NAME_MAX + 1];
 
-	snprintf(fullname, sizeof(fullname) - 1, "%s/ppt%.8lx.doc",
+	snprintf(fullname, sizeof(fullname) - 1, "%s"PATHSEP"ppt%.8lx.doc",
 		dir, (long)lseek(fd, 0L, SEEK_CUR));
 
 	ofd = open(fullname, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY|O_EXCL,
diff --git a/libclamunrar_iface/unrar_iface.c b/libclamunrar_iface/unrar_iface.c
index 3ec7cad..6a03f14 100644
--- a/libclamunrar_iface/unrar_iface.c
+++ b/libclamunrar_iface/unrar_iface.c
@@ -274,7 +274,7 @@ int unrar_open(int fd, const char *dirname, unrar_state_t *state)
 	return UNRAR_PASSWD;
     }
 
-    snprintf(filename,1024,"%s/comments", dirname);
+    snprintf(filename,1024,"%s"PATHSEP"comments", dirname);
     if(mkdir(filename,0700)) {
 	unrar_dbgmsg("UNRAR: Unable to create comment temporary directory\n");
 	free(main_hdr);
@@ -320,7 +320,7 @@ int unrar_open(int fd, const char *dirname, unrar_state_t *state)
 	    unrar_dbgmsg("UNRAR: UnPack Size: 0x%.4x\n", comment_header->unpack_size);
 	    unrar_dbgmsg("UNRAR: UnPack Version: 0x%.2x\n", comment_header->unpack_ver);
 	    unrar_dbgmsg("UNRAR: Pack Method: 0x%.2x\n", comment_header->method);
-	    snprintf(filename, 1024, "%s/main.cmt", state->comment_dir);
+	    snprintf(filename, 1024, "%s"PATHSEP"main.cmt", state->comment_dir);
 	    ofd = open(filename, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0600);
 	    if(ofd < 0) {
 		unrar_dbgmsg("UNRAR: ERROR: Failed to open output file\n");
@@ -418,7 +418,7 @@ int unrar_extract_next_prepare(unrar_state_t *state, const char *dirname)
 	    if((comment_header->unpack_ver < 15) || (comment_header->unpack_ver > 29) || (comment_header->method > 0x30)) {
 		unrar_dbgmsg("UNRAR: Can't process file comment - skipping\n");
 	    } else {
-		snprintf(filename, 1024, "%s/%lu.cmt", state->comment_dir, state->file_count);
+		snprintf(filename, 1024, "%s"PATHSEP"%lu.cmt", state->comment_dir, state->file_count);
 		ofd = open(filename, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0600);
 		if(ofd < 0) {
 		    free(comment_header);
@@ -460,7 +460,7 @@ int unrar_extract_next(unrar_state_t *state, const char *dirname)
 	unrar_dbgmsg("UNRAR: Skipping file inside multi-volume solid archive\n");
 
     } else {
-	snprintf(state->filename, 1024, "%s/%lu.ura", dirname, state->file_count);
+	snprintf(state->filename, 1024, "%s"PATHSEP"%lu.ura", dirname, state->file_count);
 	ofd = open(state->filename, O_RDWR|O_CREAT|O_TRUNC|O_BINARY, 0600);
 	if(ofd < 0) {
 	    free(state->file_header->filename);
diff --git a/shared/actions.c b/shared/actions.c
index bc10109..044751d 100644
--- a/shared/actions.c
+++ b/shared/actions.c
@@ -62,7 +62,7 @@ static int getdest(const char *fullpath, char **newname) {
 	free(tmps);
 	return -1;
     }
-    sprintf(*newname, "%s/%s", actarget, filename);
+    sprintf(*newname, "%s"PATHSEP"%s", actarget, filename);
     for(i=1; i<1000; i++) {
 	fd = open(*newname, O_WRONLY | O_CREAT | O_EXCL, 0600);
 	if(fd >= 0) {
@@ -70,7 +70,7 @@ static int getdest(const char *fullpath, char **newname) {
 	    return fd;
 	}
 	if(errno != EEXIST) break;
-	sprintf(*newname, "%s/%s.%03u", actarget, filename, i);
+	sprintf(*newname, "%s"PATHSEP"%s.%03u", actarget, filename, i);
     }
     free(tmps);
     free(*newname);
diff --git a/shared/misc.c b/shared/misc.c
index 60030c8..2657644 100644
--- a/shared/misc.c
+++ b/shared/misc.c
@@ -76,14 +76,14 @@ char *freshdbdir(void)
 	if((opt = optget(opts, "DatabaseDirectory"))->enabled) {
 	    if(strcmp(dbdir, opt->strarg)) {
 		    char *daily = (char *) malloc(strlen(opt->strarg) + strlen(dbdir) + 30);
-		sprintf(daily, "%s/daily.cvd", opt->strarg);
+		sprintf(daily, "%s"PATHSEP"daily.cvd", opt->strarg);
 		if(access(daily, R_OK))
-		    sprintf(daily, "%s/daily.cld", opt->strarg);
+		    sprintf(daily, "%s"PATHSEP"daily.cld", opt->strarg);
 
 		if(!access(daily, R_OK) && (d1 = cl_cvdhead(daily))) {
-		    sprintf(daily, "%s/daily.cvd", dbdir);
+		    sprintf(daily, "%s"PATHSEP"daily.cvd", dbdir);
 		    if(access(daily, R_OK))
-			sprintf(daily, "%s/daily.cld", dbdir);
+			sprintf(daily, "%s"PATHSEP"daily.cld", dbdir);
 
 		    if(!access(daily, R_OK) && (d2 = cl_cvdhead(daily))) {
 			free(daily);
@@ -133,9 +133,9 @@ void print_version(const char *dbdir)
 	return;
     }
 
-    sprintf(path, "%s/daily.cvd", pt);
+    sprintf(path, "%s"PATHSEP"daily.cvd", pt);
     if(access(path, R_OK))
-	sprintf(path, "%s/daily.cld", pt);
+	sprintf(path, "%s"PATHSEP"daily.cld", pt);
 
     if(!dbdir)
 	free(fdbdir);
@@ -281,20 +281,9 @@ int match_regex(const char *filename, const char *pattern)
 	if(cli_regcomp(&reg, pattern, flags) != 0)
 	    return 2;
 
-#if !defined(C_OS2) && !defined(C_WINDOWS)
-	if(pattern[strlen(pattern) - 1] == '/') {
-	    snprintf(fname, 511, "%s/", filename);
+	if(pattern[strlen(pattern) - 1] == *PATHSEP) {
+	    snprintf(fname, 511, "%s"PATHSEP, filename);
 	    fname[512] = 0;
-#else
-	if(pattern[strlen(pattern) - 1] == '\\') {
-	    strncpy(fname, filename, 510);
-	    fname[509]='\0';
-	    len = strlen(fname);
-	    if(fname[len - 1] != '\\') {
-		fname[len] = '\\';
-		fname[len + 1] = 0;
-	    }
-#endif
 	} else {
 	    strncpy(fname, filename, 513);
 	    fname[512]='\0';
diff --git a/sigtool/sigtool.c b/sigtool/sigtool.c
index 27f4526..bc61785 100644
--- a/sigtool/sigtool.c
+++ b/sigtool/sigtool.c
@@ -617,9 +617,9 @@ static int build(const struct optstruct *opts)
 
     } else {
 	pt = freshdbdir();
-	snprintf(olddb, sizeof(olddb), "%s/%s.cvd", pt, dbname);
+	snprintf(olddb, sizeof(olddb), "%s"PATHSEP"%s.cvd", pt, dbname);
 	if(access(olddb, R_OK))
-	    snprintf(olddb, sizeof(olddb), "%s/%s.cld", pt, dbname);
+	    snprintf(olddb, sizeof(olddb), "%s"PATHSEP"%s.cld", pt, dbname);
 	free(pt);
     }
 
@@ -910,9 +910,9 @@ static int unpack(const struct optstruct *opts)
 
     if(optget(opts, "unpack-current")->enabled) {
 	dbdir = freshdbdir();
-	snprintf(name, sizeof(name), "%s/%s.cvd", dbdir, optget(opts, "unpack-current")->strarg);
+	snprintf(name, sizeof(name), "%s"PATHSEP"%s.cvd", dbdir, optget(opts, "unpack-current")->strarg);
 	if(access(name, R_OK)) {
-	    snprintf(name, sizeof(name), "%s/%s.cld", dbdir, optget(opts, "unpack-current")->strarg);
+	    snprintf(name, sizeof(name), "%s"PATHSEP"%s.cld", dbdir, optget(opts, "unpack-current")->strarg);
 	    if(access(name, R_OK)) {
 		mprintf("!unpack: Couldn't find %s CLD/CVD database\n", optget(opts, "unpack-current")->strarg);
 		free(dbdir);
@@ -1013,7 +1013,7 @@ static int listdir(const char *dirname)
 		    closedir(dd);
 		    return -1;
 		}
-		sprintf(dbfile, "%s/%s", dirname, dent->d_name);
+		sprintf(dbfile, "%s"PATHSEP"%s", dirname, dent->d_name);
 
 		if(listdb(dbfile) == -1) {
 		    mprintf("!listdb: Error listing database %s\n", dbfile);
@@ -1466,8 +1466,8 @@ static int dircopy(const char *src, const char *dest)
 	    if(!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, ".."))
 		continue;
 
-	    snprintf(spath, sizeof(spath), "%s/%s", src, dent->d_name);
-	    snprintf(dpath, sizeof(dpath), "%s/%s", dest, dent->d_name);
+	    snprintf(spath, sizeof(spath), "%s"PATHSEP"%s", src, dent->d_name);
+	    snprintf(dpath, sizeof(dpath), "%s"PATHSEP"%s", dest, dent->d_name);
 
 	    if(filecopy(spath, dpath) == -1) {
 		/* mprintf("!dircopy: Can't copy %s to %s\n", spath, dpath); */
@@ -1612,7 +1612,7 @@ static int diffdirs(const char *old, const char *new, const char *patch)
 	    if(!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, ".."))
 		continue;
 
-	    snprintf(path, sizeof(path), "%s/%s", old, dent->d_name);
+	    snprintf(path, sizeof(path), "%s"PATHSEP"%s", old, dent->d_name);
 	    if(compare(path, dent->d_name, diff) == -1) {
 		if(chdir(cwd) == -1)
 		    mprintf("^diffdirs: Can't chdir to %s\n", cwd);
@@ -1638,7 +1638,7 @@ static int diffdirs(const char *old, const char *new, const char *patch)
 	    if(!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, ".."))
 		continue;
 
-	    snprintf(path, sizeof(path), "%s/%s", new, dent->d_name);
+	    snprintf(path, sizeof(path), "%s"PATHSEP"%s", new, dent->d_name);
 	    if(access(path, R_OK))
 		fprintf(diff, "UNLINK %s\n", dent->d_name);
 	}
diff --git a/sigtool/vba.c b/sigtool/vba.c
index 13bfade..143c637 100644
--- a/sigtool/vba.c
+++ b/sigtool/vba.c
@@ -974,7 +974,7 @@ static int sigtool_scandir (const char *dirname, int hex_output)
 		if (strcmp (dent->d_name, ".") && strcmp (dent->d_name, "..")) {
 		    /* build the full name */
 		    fname = (char *) cli_calloc (strlen (dirname) + strlen (dent->d_name) + 2, sizeof (char));
-		    sprintf (fname, "%s/%s", dirname, dent->d_name);
+		    sprintf (fname, "%s"PATHSEP"%s", dirname, dent->d_name);
 
 		    /* stat the file */
 		    if (lstat (fname, &statbuf) != -1) {
@@ -1047,7 +1047,7 @@ int sigtool_vba_scandir (const char *dirname, int hex_output, struct uniq *U)
 
 	for(i = 0; i < vba_project->count; i++) {
 	    for(j = 0; j < vba_project->colls[i]; j++) {
-		snprintf(vbaname, 1024, "%s/%s_%u", vba_project->dir, vba_project->name[i], j);
+		snprintf(vbaname, 1024, "%s"PATHSEP"%s_%u", vba_project->dir, vba_project->name[i], j);
 		vbaname[sizeof(vbaname)-1] = '\0';
 		fd = open(vbaname, O_RDONLY|O_BINARY);
 		if(fd == -1) continue;
@@ -1073,7 +1073,7 @@ int sigtool_vba_scandir (const char *dirname, int hex_output, struct uniq *U)
 
     if((hashcnt = uniq_get(U, "powerpoint document", 19, &hash))) {
 	while(hashcnt--) {
-	    snprintf(vbaname, 1024, "%s/%s_%u", dirname, hash, hashcnt);
+	    snprintf(vbaname, 1024, "%s"PATHSEP"%s_%u", dirname, hash, hashcnt);
 	    vbaname[sizeof(vbaname)-1] = '\0';
 	    fd = open(vbaname, O_RDONLY|O_BINARY);
 	    if (fd == -1) continue;
@@ -1089,7 +1089,7 @@ int sigtool_vba_scandir (const char *dirname, int hex_output, struct uniq *U)
 
     if ((hashcnt = uniq_get(U, "worddocument", 12, &hash))) {
 	while(hashcnt--) {
-	    snprintf(vbaname, sizeof(vbaname), "%s/%s_%u", dirname, hash, hashcnt);
+	    snprintf(vbaname, sizeof(vbaname), "%s"PATHSEP"%s_%u", dirname, hash, hashcnt);
 	    vbaname[sizeof(vbaname)-1] = '\0';
 	    fd = open(vbaname, O_RDONLY|O_BINARY);
 	    if (fd == -1) continue;
@@ -1127,7 +1127,7 @@ int sigtool_vba_scandir (const char *dirname, int hex_output, struct uniq *U)
 		if (strcmp (dent->d_name, ".") && strcmp (dent->d_name, "..")) {
 		    /* build the full name */
 		    fullname = calloc (strlen (dirname) + strlen (dent->d_name) + 2, sizeof (char));
-		    sprintf (fullname, "%s/%s", dirname, dent->d_name);
+		    sprintf (fullname, "%s"PATHSEP"%s", dirname, dent->d_name);
 
 		    /* stat the file */
 		    if (lstat (fullname, &statbuf) != -1) {

-- 
Debian repository for ClamAV



More information about the Pkg-clamav-commits mailing list