Browse code

Handle multipart messages that have no text portion

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

Nigel Horne authored on 2003/11/04 17:28:47
Showing 2 changed files
... ...
@@ -1,3 +1,8 @@
1
+Tue Nov  4 08:27:00 GMT 2003 (njh)
2
+----------------------------------
3
+  * libclamav: Handle multipart messages that have no text portion
4
+  	(Fix by NJH, Bug notified by Laurent Wacrenier <lwa@teaser.fr>)
5
+
1 6
 Tue Nov  4 00:37:03 CET 2003 (tk)
2 7
 ---------------------------------
3 8
   * clamd: fixed signature counter (thanks to Dirk Kraemer)
... ...
@@ -17,6 +17,9 @@
17 17
  *
18 18
  * Change History:
19 19
  * $Log: mbox.c,v $
20
+ * Revision 1.16  2003/11/04 08:24:00  nigelhorne
21
+ * Handle multipart messages that have no text portion
22
+ *
20 23
  * Revision 1.15  2003/10/12 20:13:49  nigelhorne
21 24
  * Use NO_STRTOK_R consistent with message.c
22 25
  *
... ...
@@ -36,7 +39,7 @@
36 36
  * Compilable under SCO; removed duplicate code with message.c
37 37
  *
38 38
  */
39
-static	char	const	rcsid[] = "$Id: mbox.c,v 1.15 2003/10/12 20:13:49 nigelhorne Exp $";
39
+static	char	const	rcsid[] = "$Id: mbox.c,v 1.16 2003/11/04 08:24:00 nigelhorne Exp $";
40 40
 
41 41
 #ifndef	CL_DEBUG
42 42
 /*#define	NDEBUG	/* map CLAMAV debug onto standard */
... ...
@@ -649,7 +652,8 @@ insert(message *mainMessage, blob **blobsIn, int nBlobs, text *textIn, const cha
649 649
 			switch(tableFind(subtypeTable, mimeSubtype)) {
650 650
 			case RELATED:
651 651
 				/*
652
-				 * Look for the text bit
652
+				 * Have a look to see if there's HTML code
653
+				 * which will need scanning
653 654
 				 */
654 655
 				aMessage = NULL;
655 656
 				assert(multiparts > 0);
... ...
@@ -660,9 +664,9 @@ insert(message *mainMessage, blob **blobsIn, int nBlobs, text *textIn, const cha
660 660
 					aText = textAddMessage(aText, messages[htmltextPart]);
661 661
 				else
662 662
 					/*
663
-					 * There isn't a text bit. If there's a
664
-					 * multipart bit, it'll probably be in
665
-					 * there somewhere
663
+					 * There isn't an HTML bit. If there's a
664
+					 * multipart bit, it'll may be in there
665
+					 * somewhere
666 666
 					 */
667 667
 					for(i = 0; i < multiparts; i++)
668 668
 						if(messageGetMimeType(messages[i]) == MULTIPART) {
... ...
@@ -671,9 +675,11 @@ insert(message *mainMessage, blob **blobsIn, int nBlobs, text *textIn, const cha
671 671
 							break;
672 672
 						}
673 673
 
674
-				assert(htmltextPart != -1);
675
-
676
-				rc = insert(aMessage, blobs, nBlobs, aText, dir, rfc821Table, subtypeTable);
674
+				if(htmltextPart == -1) {
675
+					cli_dbgmsg("No HTML code found to be scanned");
676
+					rc = 0;
677
+				} else
678
+					rc = insert(aMessage, blobs, nBlobs, aText, dir, rfc821Table, subtypeTable);
677 679
 				blobArrayDestroy(blobs, nBlobs);
678 680
 				blobs = NULL;
679 681
 				nBlobs = 0;