Browse code

Fix crash with correctly encoded uuencode files

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

Nigel Horne authored on 2004/11/09 01:27:09
Showing 2 changed files
... ...
@@ -17,6 +17,9 @@
17 17
  *
18 18
  * Change History:
19 19
  * $Log: mbox.c,v $
20
+ * Revision 1.169  2004/11/08 16:27:09  nigelhorne
21
+ * Fix crash with correctly encoded uuencode files
22
+ *
20 23
  * Revision 1.168  2004/11/08 10:26:22  nigelhorne
21 24
  * Fix crash if x-yencode is mistakenly guessed
22 25
  *
... ...
@@ -492,7 +495,7 @@
492 492
  * Compilable under SCO; removed duplicate code with message.c
493 493
  *
494 494
  */
495
-static	char	const	rcsid[] = "$Id: mbox.c,v 1.168 2004/11/08 10:26:22 nigelhorne Exp $";
495
+static	char	const	rcsid[] = "$Id: mbox.c,v 1.169 2004/11/08 16:27:09 nigelhorne Exp $";
496 496
 
497 497
 #if HAVE_CONFIG_H
498 498
 #include "clamav-config.h"
... ...
@@ -3037,7 +3040,7 @@ checkURLs(message *m, const char *dir)
3037 3037
 			/*
3038 3038
 			 * TODO: maximum size and timeouts
3039 3039
 			 */
3040
-			snprintf(cmd, sizeof(cmd), "GET -t10 %s > %s/%s 2>/dev/null", url, dir, name);
3040
+			snprintf(cmd, sizeof(cmd) - 1, "GET -t10 %s > %s/%s 2>/dev/null", url, dir, name);
3041 3041
 			cli_dbgmsg("%s\n", cmd);
3042 3042
 #ifdef	CL_THREAD_SAFE
3043 3043
 			pthread_mutex_lock(&system_mutex);
... ...
@@ -17,6 +17,9 @@
17 17
  *
18 18
  * Change History:
19 19
  * $Log: message.c,v $
20
+ * Revision 1.111  2004/11/08 16:27:09  nigelhorne
21
+ * Fix crash with correctly encoded uuencode files
22
+ *
20 23
  * Revision 1.110  2004/11/08 10:26:22  nigelhorne
21 24
  * Fix crash if x-yencode is mistakenly guessed
22 25
  *
... ...
@@ -327,7 +330,7 @@
327 327
  * uuencodebegin() no longer static
328 328
  *
329 329
  */
330
-static	char	const	rcsid[] = "$Id: message.c,v 1.110 2004/11/08 10:26:22 nigelhorne Exp $";
330
+static	char	const	rcsid[] = "$Id: message.c,v 1.111 2004/11/08 16:27:09 nigelhorne Exp $";
331 331
 
332 332
 #if HAVE_CONFIG_H
333 333
 #include "clamav-config.h"
... ...
@@ -2155,7 +2158,9 @@ decodeLine(message *m, encoding_type et, const char *line, unsigned char *buf, s
2155 2155
 			if((line[0] & 0x3F) == ' ')
2156 2156
 				break;
2157 2157
 
2158
-			len = *line++ - ' ';
2158
+			/* Don't trust the encoded length */
2159
+			/*len = *line++ - ' ';*/
2160
+			len = strlen(++line);
2159 2161
 
2160 2162
 			if(len > buflen)
2161 2163
 				/*
... ...
@@ -2239,9 +2244,9 @@ decode(message *m, const char *in, unsigned char *out, unsigned char (*decoder)(
2239 2239
 	unsigned char b1, b2, b3, b4;
2240 2240
 	unsigned char cb1, cb2, cb3;	/* carried over from last line */
2241 2241
 
2242
-	/*cli_dbgmsg("decode %s (len %d ifFast %d base64chars %d)\n", in,
2242
+	cli_dbgmsg("decode %s (len %d isFast %d base64chars %d)\n", in,
2243 2243
 		in ? strlen(in) : 0,
2244
-		isFast, m->base64chars);*/
2244
+		isFast, m->base64chars);
2245 2245
 
2246 2246
 	cb1 = cb2 = cb3 = '\0';
2247 2247