Browse code

Fix crash when a multipart/mixed message contains many parts that need to be scanned as attachments

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

Nigel Horne authored on 2004/06/21 19:22:36
Showing 2 changed files
... ...
@@ -1,3 +1,8 @@
1
+Mon Jun 21 11:21:48 BST 2004 (njh)
2
+----------------------------------
3
+  * libclamav/mbox.c:		Fix crash when a multipart/mixed message
4
+	contains many parts that need to be scanned as attachments
5
+
1 6
 Fri Jun 18 11:08:26 BST 2004 (njh)
2 7
 ----------------------------------
3 8
   * libclamav:			Allow any number of alternatives in
... ...
@@ -17,6 +17,9 @@
17 17
  *
18 18
  * Change History:
19 19
  * $Log: mbox.c,v $
20
+ * Revision 1.78  2004/06/21 10:21:19  nigelhorne
21
+ * Fix crash when a multipart/mixed message contains many parts that need to be scanned as attachments
22
+ *
20 23
  * Revision 1.77  2004/06/18 10:07:12  nigelhorne
21 24
  * Allow any number of alternatives in multipart messages
22 25
  *
... ...
@@ -219,7 +222,7 @@
219 219
  * Compilable under SCO; removed duplicate code with message.c
220 220
  *
221 221
  */
222
-static	char	const	rcsid[] = "$Id: mbox.c,v 1.77 2004/06/18 10:07:12 nigelhorne Exp $";
222
+static	char	const	rcsid[] = "$Id: mbox.c,v 1.78 2004/06/21 10:21:19 nigelhorne Exp $";
223 223
 
224 224
 #if HAVE_CONFIG_H
225 225
 #include "clamav-config.h"
... ...
@@ -1242,9 +1245,16 @@ parseEmailBody(message *messageIn, blob **blobsIn, int nBlobs, text *textIn, con
1242 1242
 					assert(addToText || addAttachment);
1243 1243
 					assert(!(addToText && addAttachment));
1244 1244
 
1245
-					if(addToText) {
1245
+					if(addToText)
1246 1246
 						aText = textAdd(aText, messageGetBody(aMessage));
1247
-					} else if(addAttachment) {
1247
+					else if(numberOfAttachments >= MAX_ATTACHMENTS) {
1248
+						cli_warnmsg("Not all attachments will be scanned\n");
1249
+						/*
1250
+						 * Try our best to save it
1251
+						 * somewhere
1252
+						 */
1253
+						aText = textAdd(aText, messageGetBody(aMessage));
1254
+					} else {
1248 1255
 						blob *aBlob = messageToBlob(aMessage);
1249 1256
 
1250 1257
 						if(aBlob) {