Browse code

Fix embedded multi parts

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

Nigel Horne authored on 2004/07/26 17:32:31
Showing 2 changed files
... ...
@@ -1,3 +1,8 @@
1
+Mon Jul 26 09:31:39 BST 2004 (njh)
2
+----------------------------------
3
+  * libclamav/message.c:	Fix occasional crash when scanning
4
+  	multipart within multipart e-mails
5
+
1 6
 Sun Jul 25 12:52:07 BST 2004 (njh)
2 7
 ----------------------------------
3 8
   * clamav-milter:	Fixed warning message when building on FreeBSD4.9
... ...
@@ -17,6 +17,9 @@
17 17
  *
18 18
  * Change History:
19 19
  * $Log: message.c,v $
20
+ * Revision 1.67  2004/07/26 08:31:04  nigelhorne
21
+ * Fix embedded multi parts
22
+ *
20 23
  * Revision 1.66  2004/07/20 15:17:44  nigelhorne
21 24
  * Remove overlapping strcpy
22 25
  *
... ...
@@ -195,7 +198,7 @@
195 195
  * uuencodebegin() no longer static
196 196
  *
197 197
  */
198
-static	char	const	rcsid[] = "$Id: message.c,v 1.66 2004/07/20 15:17:44 nigelhorne Exp $";
198
+static	char	const	rcsid[] = "$Id: message.c,v 1.67 2004/07/26 08:31:04 nigelhorne Exp $";
199 199
 
200 200
 #if HAVE_CONFIG_H
201 201
 #include "clamav-config.h"
... ...
@@ -1392,6 +1395,24 @@ messageToText(message *m)
1392 1392
 				if(strchr(line, '='))
1393 1393
 					break;
1394 1394
 		}
1395
+		if(m->base64chars) {
1396
+			unsigned char data[4];
1397
+			unsigned char *ptr;
1398
+
1399
+			ptr = decode(m, NULL, data, base64, FALSE);
1400
+			if(ptr) {
1401
+				if(first == NULL)
1402
+					first = last = cli_malloc(sizeof(text));
1403
+				else {
1404
+					last->t_next = cli_malloc(sizeof(text));
1405
+					last = last->t_next;
1406
+				}
1407
+
1408
+				if(last != NULL)
1409
+					last->t_text = data[0] ? strdup((char *)data) : NULL;
1410
+			}
1411
+			m->base64chars = 0;
1412
+		}
1395 1413
 	}
1396 1414
 
1397 1415
 	if(last)