Browse code

Prevent infinite recursion on broken uuencoded files

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

Nigel Horne authored on 2004/01/23 07:16:19
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Thu Jan 22 22:14:13 GMT 2004 (njh)
2
+----------------------------------
3
+  * libclamav: Prevent infinite recursion on broken uuencoded files
4
+
1 5
 Wed Jan 21 09:38:01 CET 2004 (tk)
2 6
 ---------------------------------
3 7
   * sigtool: --list-sigs: list virus signature names from all databases.
... ...
@@ -17,6 +17,9 @@
17 17
  *
18 18
  * Change History:
19 19
  * $Log: mbox.c,v $
20
+ * Revision 1.31  2004/01/22 22:13:06  nigelhorne
21
+ * Prevent infinite recursion on broken uuencoded files
22
+ *
20 23
  * Revision 1.30  2004/01/13 10:12:05  nigelhorne
21 24
  * Remove duplicate code when handling multipart messages
22 25
  *
... ...
@@ -81,7 +84,7 @@
81 81
  * Compilable under SCO; removed duplicate code with message.c
82 82
  *
83 83
  */
84
-static	char	const	rcsid[] = "$Id: mbox.c,v 1.30 2004/01/13 10:12:05 nigelhorne Exp $";
84
+static	char	const	rcsid[] = "$Id: mbox.c,v 1.31 2004/01/22 22:13:06 nigelhorne Exp $";
85 85
 
86 86
 #ifndef	CL_DEBUG
87 87
 /*#define	NDEBUG	/* map CLAMAV debug onto standard */
... ...
@@ -919,7 +922,18 @@ parseEmailBody(message *mainMessage, blob **blobsIn, int nBlobs, text *textIn, c
919 919
 					blobList[numberOfAttachments++] = blobs[i];
920 920
 				}
921 921
 
922
-				rc = parseEmailBody(mainMessage, blobList, numberOfAttachments, aText, dir, rfc821Table, subtypeTable);
922
+				/*
923
+				 * If there's only one part of the MULTIPART
924
+				 * we already have the body to decode so
925
+				 * there's no more work to do.
926
+				 *
927
+				 * This is mostly for the situation where
928
+				 * broken code which claim to be multipart
929
+				 * which aren't was causing us to go into
930
+				 * infinite recursion
931
+				 */
932
+				if(multiparts > 1)
933
+					rc = parseEmailBody(mainMessage, blobList, numberOfAttachments, aText, dir, rfc821Table, subtypeTable);
923 934
 				break;
924 935
 			case DIGEST:
925 936
 				/*