Browse code

Harden the test for the start of a new mail in an mbox

git-svn: trunk@1619

Nigel Horne authored on 2005/06/18 22:26:13
Showing 2 changed files
... ...
@@ -1,3 +1,9 @@
1
+Sat Jun 18 14:24:54 BST 2005 (njh)
2
+----------------------------------
3
+  * libclamav/mbox.c:	Harden the test for the start of a new message in mbox,
4
+		based on a suggestion by "Andrey J. Melnikoff (TEMHOTA)"
5
+		<temnota at kmv.ru>
6
+
1 7
 Sat Jun 18 02:22:26 CEST 2005 (tk)
2 8
 ----------------------------------
3 9
   * libclamav/mspack/cabd.c: fix possible infinite loop
... ...
@@ -23,7 +29,7 @@ Sun Jun 12 11:24:59 CEST 2005 (tk)
23 23
 Wed Jun  8 16:01:22 CEST 2005 (tk)
24 24
 ----------------------------------
25 25
   * libclamav/zziplib/zzip-file.c: add method id for AES encrypted archives
26
-    (thanks to David Majorel <dm*lagoon.nc>). 
26
+    (thanks to David Majorel <dm*lagoon.nc>).
27 27
 
28 28
 Wed Jun  8 15:37:34 CEST 2005 (tk)
29 29
 ----------------------------------
... ...
@@ -15,7 +15,7 @@
15 15
  *  along with this program; if not, write to the Free Software
16 16
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 17
  */
18
-static	char	const	rcsid[] = "$Id: mbox.c,v 1.247 2005/06/01 15:01:44 nigelhorne Exp $";
18
+static	char	const	rcsid[] = "$Id: mbox.c,v 1.248 2005/06/18 13:23:42 nigelhorne Exp $";
19 19
 
20 20
 #if HAVE_CONFIG_H
21 21
 #include "clamav-config.h"
... ...
@@ -811,7 +811,7 @@ cli_parse_mbox(const char *dir, int desc, unsigned int options)
811 811
 	 * message is stopped, and giving a better indication of which message
812 812
 	 * within the mailbox is infected
813 813
 	 */
814
-	if(strncmp(buffer, "From ", 5) == 0) {
814
+	if((strncmp(buffer, "From ", 5) == 0) && isalnum(buffer[5])) {
815 815
 		/*
816 816
 		 * Have been asked to check a UNIX style mbox file, which
817 817
 		 * may contain more than one e-mail message to decode
... ...
@@ -850,7 +850,7 @@ cli_parse_mbox(const char *dir, int desc, unsigned int options)
850 850
 
851 851
 		do {
852 852
 			cli_chomp(buffer);
853
-			if(lastLineWasEmpty && (strncmp(buffer, "From ", 5) == 0)) {
853
+			if(lastLineWasEmpty && (strncmp(buffer, "From ", 5) == 0) && isalnum(buffer[5])) {
854 854
 				cli_dbgmsg("Deal with email number %d\n", messagenumber++);
855 855
 				/*
856 856
 				 * End of a message in the mail box