Browse code

Remove empty parts

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

Nigel Horne authored on 2004/06/28 20:47:16
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Mon Jun 28 12:46:18 BST 2004 (njh)
2
+----------------------------------
3
+  * libclamav/mbox.c:	Optimise the scanning of empty sections of e-mails
4
+
1 5
 Mon Jun 28 09:36:34 BST 2004 (njh)
2 6
 ----------------------------------
3 7
   * clamav-milter:	Don't error when creating the quarantine directory if it
... ...
@@ -17,6 +17,9 @@
17 17
  *
18 18
  * Change History:
19 19
  * $Log: mbox.c,v $
20
+ * Revision 1.83  2004/06/28 11:44:45  nigelhorne
21
+ * Remove empty parts
22
+ *
20 23
  * Revision 1.82  2004/06/25 13:56:38  nigelhorne
21 24
  * Optimise messages without other messages encapsulated within them
22 25
  *
... ...
@@ -234,7 +237,7 @@
234 234
  * Compilable under SCO; removed duplicate code with message.c
235 235
  *
236 236
  */
237
-static	char	const	rcsid[] = "$Id: mbox.c,v 1.82 2004/06/25 13:56:38 nigelhorne Exp $";
237
+static	char	const	rcsid[] = "$Id: mbox.c,v 1.83 2004/06/28 11:44:45 nigelhorne Exp $";
238 238
 
239 239
 #if HAVE_CONFIG_H
240 240
 #include "clamav-config.h"
... ...
@@ -677,6 +680,9 @@ parseEmailHeader(message *m, const char *line, const table_t *rfc821Table)
677 677
 
678 678
 	copy = strdup(line);
679 679
 
680
+	if(copy == NULL)
681
+		return -1;
682
+
680 683
 	cmd = strtok_r(copy, ":", &strptr);
681 684
 
682 685
 	if(cmd && *cmd) {
... ...
@@ -854,6 +860,8 @@ parseEmailBody(message *messageIn, blob **blobsIn, int nBlobs, text *textIn, con
854 854
 
855 855
 				if(t_line == NULL) {
856 856
 					cli_dbgmsg("Empty part\n");
857
+					messageDestroy(aMessage);
858
+					--multiparts;
857 859
 					continue;
858 860
 				}
859 861
 
... ...
@@ -2105,19 +2113,18 @@ saveFile(const blob *b, const char *dir)
2105 2105
 	return (close(fd) >= 0);
2106 2106
 }
2107 2107
 
2108
-#ifdef	CL_DEBUG
2108
+#ifdef HAVE_BACKTRACE
2109 2109
 static void
2110 2110
 sigsegv(int sig)
2111 2111
 {
2112 2112
 	signal(SIGSEGV, SIG_DFL);
2113
-	print_trace(0);
2113
+	print_trace(1);
2114 2114
 	exit(SIGSEGV);
2115 2115
 }
2116 2116
 
2117 2117
 static void
2118 2118
 print_trace(int use_syslog)
2119 2119
 {
2120
-#ifdef HAVE_BACKTRACE
2121 2120
 	void *array[10];
2122 2121
 	size_t size;
2123 2122
 	char **strings;
... ...
@@ -2127,8 +2134,6 @@ print_trace(int use_syslog)
2127 2127
 	size = backtrace(array, 10);
2128 2128
 	strings = backtrace_symbols(array, size);
2129 2129
 
2130
-	syslog(LOG_ERR, "Backtrace of pid %d:", pid);
2131
-
2132 2130
 	if(use_syslog == 0)
2133 2131
 		cli_dbgmsg("Backtrace of pid %d:\n", pid);
2134 2132
 	else
... ...
@@ -2141,6 +2146,5 @@ print_trace(int use_syslog)
2141 2141
 			cli_dbgmsg("%s\n", strings[i]);
2142 2142
 
2143 2143
 	free(strings);
2144
-#endif
2145 2144
 }
2146 2145
 #endif