git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@645 77e5149b-7576-45b1-b177-96237e5ba77b
Nigel Horne authored on 2004/06/30 23:32:28... | ... |
@@ -1,3 +1,7 @@ |
1 |
+Wed Jun 30 15:31:54 BST 2004 (njh) |
|
2 |
+---------------------------------- |
|
3 |
+ * libclamav/mbox.c: Fix compilation error on old Solaris |
|
4 |
+ |
|
1 | 5 |
Wed Jun 30 13:24:56 BST 2004 (trog) |
2 | 6 |
----------------------------------- |
3 | 7 |
* libclamav/vba_extract.c: dumb down the PowerPoint parser to Microsofts level. |
... | ... |
@@ -17,6 +17,9 @@ |
17 | 17 |
* |
18 | 18 |
* Change History: |
19 | 19 |
* $Log: mbox.c,v $ |
20 |
+ * Revision 1.84 2004/06/30 14:30:40 nigelhorne |
|
21 |
+ * Fix compilation error on Solaris |
|
22 |
+ * |
|
20 | 23 |
* Revision 1.83 2004/06/28 11:44:45 nigelhorne |
21 | 24 |
* Remove empty parts |
22 | 25 |
* |
... | ... |
@@ -237,7 +240,7 @@ |
237 | 237 |
* Compilable under SCO; removed duplicate code with message.c |
238 | 238 |
* |
239 | 239 |
*/ |
240 |
-static char const rcsid[] = "$Id: mbox.c,v 1.83 2004/06/28 11:44:45 nigelhorne Exp $"; |
|
240 |
+static char const rcsid[] = "$Id: mbox.c,v 1.84 2004/06/30 14:30:40 nigelhorne Exp $"; |
|
241 | 241 |
|
242 | 242 |
#if HAVE_CONFIG_H |
243 | 243 |
#include "clamav-config.h" |
... | ... |
@@ -285,12 +288,12 @@ static char const rcsid[] = "$Id: mbox.c,v 1.83 2004/06/28 11:44:45 nigelhorne E |
285 | 285 |
#if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 |
286 | 286 |
#define HAVE_BACKTRACE |
287 | 287 |
#endif |
288 |
+#endif |
|
288 | 289 |
|
289 | 290 |
#ifdef HAVE_BACKTRACE |
290 | 291 |
#include <execinfo.h> |
291 | 292 |
#include <signal.h> |
292 | 293 |
#include <syslog.h> |
293 |
-#endif |
|
294 | 294 |
|
295 | 295 |
static void sigsegv(int sig); |
296 | 296 |
static void print_trace(int use_syslog); |
... | ... |
@@ -445,7 +448,7 @@ cl_mbox(const char *dir, int desc) |
445 | 445 |
m = messageCreate(); |
446 | 446 |
if(m == NULL) { |
447 | 447 |
fclose(fd); |
448 |
- return 0; |
|
448 |
+ return -1; |
|
449 | 449 |
} |
450 | 450 |
|
451 | 451 |
#ifdef CL_THREAD_SAFE |
... | ... |
@@ -469,7 +472,7 @@ cl_mbox(const char *dir, int desc) |
469 | 469 |
pthread_mutex_unlock(&tables_mutex); |
470 | 470 |
#endif |
471 | 471 |
|
472 |
-#ifdef CL_DEBUG |
|
472 |
+#ifdef HAVE_BACKTRACE |
|
473 | 473 |
segv = signal(SIGSEGV, sigsegv); |
474 | 474 |
#endif |
475 | 475 |
|
... | ... |
@@ -556,7 +559,7 @@ cl_mbox(const char *dir, int desc) |
556 | 556 |
|
557 | 557 |
cli_dbgmsg("cli_mbox returning %d\n", retcode); |
558 | 558 |
|
559 |
-#ifdef CL_DEBUG |
|
559 |
+#ifdef HAVE_BACKTRACE |
|
560 | 560 |
signal(SIGSEGV, segv); |
561 | 561 |
#endif |
562 | 562 |
|
... | ... |
@@ -775,6 +778,15 @@ parseEmailBody(message *messageIn, blob **blobsIn, int nBlobs, text *textIn, con |
775 | 775 |
break; |
776 | 776 |
case TEXT: |
777 | 777 |
if(tableFind(subtypeTable, mimeSubtype) == PLAIN) |
778 |
+ /* |
|
779 |
+ * Consider what to do if this fails |
|
780 |
+ * (i.e. aText == NULL): |
|
781 |
+ * We mustn't just return since that could |
|
782 |
+ * cause a virus to be missed that we |
|
783 |
+ * could be capable of scanning. Ignoring |
|
784 |
+ * the error is probably the safest, we may be |
|
785 |
+ * able to scan anyway and we lose nothing |
|
786 |
+ */ |
|
778 | 787 |
aText = textCopy(messageGetBody(mainMessage)); |
779 | 788 |
break; |
780 | 789 |
case MULTIPART: |
... | ... |
@@ -846,6 +858,10 @@ parseEmailBody(message *messageIn, blob **blobsIn, int nBlobs, text *textIn, con |
846 | 846 |
messages = cli_realloc(messages, ((multiparts + 1) * sizeof(message *))); |
847 | 847 |
|
848 | 848 |
aMessage = messages[multiparts] = messageCreate(); |
849 |
+ if(aMessage == NULL) { |
|
850 |
+ multiparts--; |
|
851 |
+ continue; |
|
852 |
+ } |
|
849 | 853 |
|
850 | 854 |
cli_dbgmsg("Now read in part %d\n", multiparts); |
851 | 855 |
|