Browse code

Fix crash when debugging on SPARC

git-svn: trunk@698

Nigel Horne authored on 2004/07/27 02:02:56
Showing 1 changed files
... ...
@@ -17,6 +17,9 @@
17 17
  *
18 18
  * Change History:
19 19
  * $Log: mbox.c,v $
20
+ * Revision 1.90  2004/07/26 17:02:56  nigelhorne
21
+ * Fix crash when debugging on SPARC
22
+ *
20 23
  * Revision 1.89  2004/07/26 09:12:12  nigelhorne
21 24
  * Fix crash when debugging on Solaris
22 25
  *
... ...
@@ -255,7 +258,7 @@
255 255
  * Compilable under SCO; removed duplicate code with message.c
256 256
  *
257 257
  */
258
-static	char	const	rcsid[] = "$Id: mbox.c,v 1.89 2004/07/26 09:12:12 nigelhorne Exp $";
258
+static	char	const	rcsid[] = "$Id: mbox.c,v 1.90 2004/07/26 17:02:56 nigelhorne Exp $";
259 259
 
260 260
 #if HAVE_CONFIG_H
261 261
 #include "clamav-config.h"
... ...
@@ -870,8 +873,14 @@ parseEmailBody(message *messageIn, blob **blobsIn, int nBlobs, text *textIn, con
870 870
 			 */
871 871
 			for(multiparts = 0; t_line; multiparts++) {
872 872
 				int lines = 0;
873
+				message **m;
873 874
 
874
-				messages = cli_realloc(messages, ((multiparts + 1) * sizeof(message *)));
875
+				m = cli_realloc(messages, ((multiparts + 1) * sizeof(message *)));
876
+				if(m == NULL) {
877
+					multiparts--;
878
+					break;
879
+				}
880
+				messages = m;
875 881
 
876 882
 				aMessage = messages[multiparts] = messageCreate();
877 883
 				if(aMessage == NULL) {
... ...
@@ -1006,7 +1015,8 @@ parseEmailBody(message *messageIn, blob **blobsIn, int nBlobs, text *textIn, con
1006 1006
 						/* t_line = NULL;*/
1007 1007
 						break;
1008 1008
 					} else {
1009
-						messageAddLine(aMessage, line, 1);
1009
+						if(messageAddLine(aMessage, line, 1) < 0)
1010
+							break;
1010 1011
 						lines++;
1011 1012
 					}
1012 1013
 				} while((t_line = t_line->t_next) != NULL);
... ...
@@ -1796,9 +1806,9 @@ endOfMessage(const char *line, const char *boundary)
1796 1796
 {
1797 1797
 	size_t len;
1798 1798
 
1799
-	cli_dbgmsg("endOfMessage: line = '%s' boundary = '%s'\n", line, boundary);
1800 1799
 	if(line == NULL)
1801 1800
 		return 0;
1801
+	cli_dbgmsg("endOfMessage: line = '%s' boundary = '%s'\n", line, boundary);
1802 1802
 	if(*line++ != '-')
1803 1803
 		return 0;
1804 1804
 	if(*line++ != '-')