git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@999 77e5149b-7576-45b1-b177-96237e5ba77b
Nigel Horne authored on 2004/10/15 02:47:19... | ... |
@@ -1,3 +1,10 @@ |
1 |
+Thu Oct 14 18:46:10 BST 2004 (njh) |
|
2 |
+---------------------------------- |
|
3 |
+ * libclamav: Handle RFC2047 on long lines produced by continuation |
|
4 |
+ headers |
|
5 |
+ Try to reclaim some memory if it becomes low when |
|
6 |
+ decoding very large files |
|
7 |
+ |
|
1 | 8 |
Wed Oct 13 22:57:21 CEST 2004 (tk) |
2 | 9 |
---------------------------------- |
3 | 10 |
* libclamav/matcher-bm.c: bound memory usage |
... | ... |
@@ -17,6 +17,9 @@ |
17 | 17 |
* |
18 | 18 |
* Change History: |
19 | 19 |
* $Log: mbox.c,v $ |
20 |
+ * Revision 1.152 2004/10/14 17:45:13 nigelhorne |
|
21 |
+ * RFC2047 on long lines produced by continuation headers |
|
22 |
+ * |
|
20 | 23 |
* Revision 1.151 2004/10/10 11:10:20 nigelhorne |
21 | 24 |
* Remove perror - replace with cli_errmsg |
22 | 25 |
* |
... | ... |
@@ -441,7 +444,7 @@ |
441 | 441 |
* Compilable under SCO; removed duplicate code with message.c |
442 | 442 |
* |
443 | 443 |
*/ |
444 |
-static char const rcsid[] = "$Id: mbox.c,v 1.151 2004/10/10 11:10:20 nigelhorne Exp $"; |
|
444 |
+static char const rcsid[] = "$Id: mbox.c,v 1.152 2004/10/14 17:45:13 nigelhorne Exp $"; |
|
445 | 445 |
|
446 | 446 |
#if HAVE_CONFIG_H |
447 | 447 |
#include "clamav-config.h" |
... | ... |
@@ -567,7 +570,11 @@ typedef enum { FALSE = 0, TRUE = 1 } bool; |
567 | 567 |
/* |
568 | 568 |
* Define this to handle RFC1341 messages. |
569 | 569 |
* This is experimental code so it is up to YOU to (1) ensure it's secure |
570 |
- * (2) peridically trim the directory of old files |
|
570 |
+ * (2) periodically trim the directory of old files |
|
571 |
+ * |
|
572 |
+ * If you use the load balancing feature of clamav-milter to run clamd on |
|
573 |
+ * more than one machine you must make sure that /tmp/partial is on a shared |
|
574 |
+ * network filesystem |
|
571 | 575 |
*/ |
572 | 576 |
/*#define PARTIAL_DIR "/tmp/partial" /* FIXME: should be config based on TMPDIR */ |
573 | 577 |
|
... | ... |
@@ -1011,8 +1018,6 @@ parseEmailHeader(message *m, const char *line, const table_t *rfc821) |
1011 | 1011 |
if(*separater == '\0') |
1012 | 1012 |
return -1; |
1013 | 1013 |
|
1014 |
- assert(strlen(line) <= LINE_LENGTH); /* RFC 821 */ |
|
1015 |
- |
|
1016 | 1014 |
copy = rfc2047(line); |
1017 | 1015 |
if(copy == NULL) |
1018 | 1016 |
return -1; |
... | ... |
@@ -2364,7 +2369,6 @@ parseMimeHeader(message *m, const char *cmd, const table_t *rfc821Table, const c |
2364 | 2364 |
int set = messageSetMimeType(m, strtok(s, "/")); |
2365 | 2365 |
#endif |
2366 | 2366 |
|
2367 |
- |
|
2368 | 2367 |
/* |
2369 | 2368 |
* Stephen White <stephen@earth.li> |
2370 | 2369 |
* Some clients put space after |
... | ... |
@@ -2549,10 +2553,9 @@ rfc2047(const char *in) |
2549 | 2549 |
|
2550 | 2550 |
/* For each RFC2047 string */ |
2551 | 2551 |
while(*in) { |
2552 |
- char encoding, *ptr; |
|
2552 |
+ char encoding, *ptr, *enctext; |
|
2553 | 2553 |
message *m; |
2554 | 2554 |
blob *b; |
2555 |
- char enctext[LINE_LENGTH + 1]; |
|
2556 | 2555 |
|
2557 | 2556 |
/* Find next RFC2047 string */ |
2558 | 2557 |
while(*in) { |
... | ... |
@@ -2582,11 +2585,17 @@ rfc2047(const char *in) |
2582 | 2582 |
if(*++in == '\0') |
2583 | 2583 |
break; |
2584 | 2584 |
|
2585 |
- assert(strlen(in) < sizeof(enctext)); |
|
2586 |
- strcpy(enctext, in); |
|
2585 |
+ enctext = strdup(in); |
|
2586 |
+ if(enctext == NULL) { |
|
2587 |
+ free(out); |
|
2588 |
+ out = NULL; |
|
2589 |
+ break; |
|
2590 |
+ } |
|
2587 | 2591 |
in = strstr(in, "?="); |
2588 |
- if(in == NULL) |
|
2592 |
+ if(in == NULL) { |
|
2593 |
+ free(enctext); |
|
2589 | 2594 |
break; |
2595 |
+ } |
|
2590 | 2596 |
in += 2; |
2591 | 2597 |
ptr = strstr(enctext, "?="); |
2592 | 2598 |
assert(ptr != NULL); |
... | ... |
@@ -2597,6 +2606,7 @@ rfc2047(const char *in) |
2597 | 2597 |
if(m == NULL) |
2598 | 2598 |
break; |
2599 | 2599 |
messageAddStr(m, enctext); |
2600 |
+ free(enctext); |
|
2600 | 2601 |
switch(encoding) { |
2601 | 2602 |
case 'q': |
2602 | 2603 |
messageSetEncoding(m, "quoted-printable"); |