Browse code

Handle text/rfc822-headers incorrectly sent as message/rfc822-headers

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

Nigel Horne authored on 2004/12/05 00:52:53
Showing 2 changed files
... ...
@@ -1,3 +1,8 @@
1
+Sat Dec  4 15:52:08 GMT 2004 (njh)
2
+----------------------------------
3
+  * libclamav/mbox.c:	Handle text/rfc822-headers incorrectly sent as
4
+				message/rfc822-headers
5
+
1 6
 Fri Dec  3 17:36:08 GMT 2004 (njh)
2 7
 ----------------------------------
3 8
   * clamav-milter:	internal: Honour scanning modes and archive limits
... ...
@@ -17,6 +17,9 @@
17 17
  *
18 18
  * Change History:
19 19
  * $Log: mbox.c,v $
20
+ * Revision 1.197  2004/12/04 15:50:39  nigelhorne
21
+ * Handle text/rfc822-headers incorrectly sent as message/rfc822-headers
22
+ *
20 23
  * Revision 1.196  2004/12/01 13:12:35  nigelhorne
21 24
  * Decode text/plain parts marked as being encoded
22 25
  *
... ...
@@ -576,7 +579,7 @@
576 576
  * Compilable under SCO; removed duplicate code with message.c
577 577
  *
578 578
  */
579
-static	char	const	rcsid[] = "$Id: mbox.c,v 1.196 2004/12/01 13:12:35 nigelhorne Exp $";
579
+static	char	const	rcsid[] = "$Id: mbox.c,v 1.197 2004/12/04 15:50:39 nigelhorne Exp $";
580 580
 
581 581
 #if HAVE_CONFIG_H
582 582
 #include "clamav-config.h"
... ...
@@ -1345,6 +1348,7 @@ parseEmailBody(message *messageIn, text *textIn, const char *dir, const table_t
1345 1345
 		mimeSubtype = messageGetMimeSubtype(mainMessage);
1346 1346
 
1347 1347
 		subtype = tableFind(subtypeTable, mimeSubtype);
1348
+		/* pre-process */
1348 1349
 		if((mimeType == TEXT) && (subtype == PLAIN)) {
1349 1350
 			/*
1350 1351
 			 * This is effectively no encoding, notice that we
... ...
@@ -1353,6 +1357,15 @@ parseEmailBody(message *messageIn, text *textIn, const char *dir, const table_t
1353 1353
 			cli_dbgmsg("assume no encoding\n");
1354 1354
 			mimeType = NOMIME;
1355 1355
 			messageSetMimeSubtype(mainMessage, NULL);
1356
+		} else if((mimeType == MESSAGE) &&
1357
+			  (strcasecmp(mimeSubtype, "rfc822-headers") == 0)) {
1358
+			/*
1359
+			 * RFC1892/RFC3462: section 2 text/rfc822-headers
1360
+			 * incorrectly sent as message/rfc822-headers
1361
+			 */
1362
+			cli_dbgmsg("Changing message/rfc822-headers to text/rfc822-headers\n");
1363
+			mimeType = TEXT;
1364
+			subtype = PLAIN;	/* parse as text/plain */
1356 1365
 		}
1357 1366
 
1358 1367
 		cli_dbgmsg("mimeType = %d\n", mimeType);