Browse code

Rework maximum recursion level code

git-svn: trunk@2739

Nigel Horne authored on 2007/02/13 22:06:11
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Tue Feb 13 13:05:30 GMT 2007 (njh)
2
+----------------------------------
3
+  * libclamav/mbox.c:	Rework maximum recursion level code (patch by TK)
4
+
1 5
 Tue Feb 13 11:59:32 CET 2007 (tk)
2 6
 ---------------------------------
3 7
   * libclamav/cab.c: properly handle errors from mspack
... ...
@@ -16,7 +16,7 @@
16 16
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 17
  *  MA 02110-1301, USA.
18 18
  */
19
-static	char	const	rcsid[] = "$Id: mbox.c,v 1.377 2007/02/13 10:02:05 njh Exp $";
19
+static	char	const	rcsid[] = "$Id: mbox.c,v 1.378 2007/02/13 13:04:40 njh Exp $";
20 20
 
21 21
 #ifdef	_MSC_VER
22 22
 #include <winsock.h>	/* only needed in CL_EXPERIMENTAL */
... ...
@@ -2046,12 +2046,15 @@ parseEmailBody(message *messageIn, text *textIn, mbox_ctx *mctx, unsigned int re
2046 2046
 		/*
2047 2047
 		 * This is approximate
2048 2048
 		 */
2049
-		if(BLOCKMAX &&
2050
-		  (recursion_level > ctx->limits->maxmailrec)) {
2051
-			cli_warnmsg("parseEmailBody: hit maximum recursion level (%u)\n",
2052
-				recursion_level);
2053
-			*ctx->virname = "MIME.RecursionLimit";
2054
-			return VIRUS;
2049
+		if(recursion_level > ctx->limits->maxmailrec) {
2050
+
2051
+			cli_warnmsg("parseEmailBody: hit maximum recursion level (%u)\n", recursion_level);
2052
+			if(BLOCKMAX) {
2053
+				if(ctx->virname)
2054
+					*ctx->virname = "MIME.RecursionLimit";
2055
+				return VIRUS;
2056
+			} else
2057
+				return OK_ATTACHMENTS_NOT_SAVED;
2055 2058
 		}
2056 2059
 	}
2057 2060
 
... ...
@@ -2187,7 +2190,7 @@ parseEmailBody(message *messageIn, text *textIn, mbox_ctx *mctx, unsigned int re
2187 2187
 							break;
2188 2188
 						}
2189 2189
 					} else if(t_line->t_next &&
2190
-					          (encodingLine(mainMessage) == t_line->t_next)) {
2190
+						 (encodingLine(mainMessage) == t_line->t_next)) {
2191 2191
 						/*
2192 2192
 						 * We look for the next line
2193 2193
 						 * since later on we'll skip