Browse code

Scan pathnames in Cygwin

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

Nigel Horne authored on 2004/08/01 17:22:58
Showing 2 changed files
... ...
@@ -1,3 +1,8 @@
1
+Sun Aug  1 09:21:50 BST 2004 (njh)
2
+----------------------------------
3
+  * libclamav/blob.c:	Ensure attachments with pathnames are scanned under
4
+  				Cygwin
5
+
1 6
 Fri Jul 30 21:08:29 CEST 2004 (tk)
2 7
 ----------------------------------
3 8
   * libclamav: mspack: fix memory leak
... ...
@@ -16,6 +16,9 @@
16 16
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 17
  *
18 18
  * $Log: blob.c,v $
19
+ * Revision 1.14  2004/08/01 08:20:58  nigelhorne
20
+ * Scan pathnames in Cygwin
21
+ *
19 22
  * Revision 1.13  2004/06/16 08:07:39  nigelhorne
20 23
  * Added thread safety
21 24
  *
... ...
@@ -41,7 +44,7 @@
41 41
  * Change LOG to Log
42 42
  *
43 43
  */
44
-static	char	const	rcsid[] = "$Id: blob.c,v 1.13 2004/06/16 08:07:39 nigelhorne Exp $";
44
+static	char	const	rcsid[] = "$Id: blob.c,v 1.14 2004/08/01 08:20:58 nigelhorne Exp $";
45 45
 
46 46
 #if HAVE_CONFIG_H
47 47
 #include "clamav-config.h"
... ...
@@ -126,7 +129,7 @@ blobSetFilename(blob *b, const char *filename)
126 126
 
127 127
 		for(ptr = b->name; *ptr; ptr++) {
128 128
 #if	defined(MSDOS) || defined(C_CYGWIN) || defined(WIN32)
129
-			if(strchr("*?<>|\"+=,;: ", *ptr))
129
+			if(strchr("/*?<>|\"+=,;: ", *ptr))
130 130
 #elif   defined(C_DARWIN)
131 131
 			if((*ptr == '/') || (*ptr >= '\200'))
132 132
 #else
... ...
@@ -173,8 +176,13 @@ blobAddData(blob *b, const unsigned char *data, size_t len)
173 173
 		b->size = len * 4;
174 174
 		b->data = cli_malloc(b->size);
175 175
 	} else if(b->size < b->len + len) {
176
+		unsigned char *p = cli_realloc(b->data, b->size + (len * 4));
177
+
178
+		if(p == NULL)
179
+			return;
180
+
176 181
 		b->size += len * 4;
177
-		b->data = cli_realloc(b->data, b->size);
182
+		b->data = p;
178 183
 	}
179 184
 
180 185
 	if(b->data) {