git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@1006 77e5149b-7576-45b1-b177-96237e5ba77b
Nigel Horne authored on 2004/10/16 18:03:43... | ... |
@@ -1,3 +1,7 @@ |
1 |
+Sat Oct 16 10:02:32 BST 2004 (njh) |
|
2 |
+---------------------------------- |
|
3 |
+ * libclamav/mbox.c: Improved handling for wraparound headers |
|
4 |
+ |
|
1 | 5 |
Sat Oct 16 02:41:17 CEST 2004 (tk) |
2 | 6 |
---------------------------------- |
3 | 7 |
* clamdscan: add missing support for --no-summary (problem reported by |
... | ... |
@@ -17,6 +17,9 @@ |
17 | 17 |
* |
18 | 18 |
* Change History: |
19 | 19 |
* $Log: mbox.c,v $ |
20 |
+ * Revision 1.154 2004/10/16 09:01:05 nigelhorne |
|
21 |
+ * Improved handling of wraparound headers |
|
22 |
+ * |
|
20 | 23 |
* Revision 1.153 2004/10/14 21:18:49 nigelhorne |
21 | 24 |
* Harden the test for RFC2047 encoded headers |
22 | 25 |
* |
... | ... |
@@ -447,7 +450,7 @@ |
447 | 447 |
* Compilable under SCO; removed duplicate code with message.c |
448 | 448 |
* |
449 | 449 |
*/ |
450 |
-static char const rcsid[] = "$Id: mbox.c,v 1.153 2004/10/14 21:18:49 nigelhorne Exp $"; |
|
450 |
+static char const rcsid[] = "$Id: mbox.c,v 1.154 2004/10/16 09:01:05 nigelhorne Exp $"; |
|
451 | 451 |
|
452 | 452 |
#if HAVE_CONFIG_H |
453 | 453 |
#include "clamav-config.h" |
... | ... |
@@ -659,7 +662,7 @@ static const struct tableinit { |
659 | 659 |
{ "Content-Transfer-Encoding", CONTENT_TRANSFER_ENCODING }, |
660 | 660 |
{ "Content-Disposition", CONTENT_DISPOSITION }, |
661 | 661 |
{ NULL, 0 } |
662 |
-}, mimeSubtypes[] = { |
|
662 |
+}, mimeSubtypes[] = { /* see RFC2045 */ |
|
663 | 663 |
/* subtypes of Text */ |
664 | 664 |
{ "plain", PLAIN }, |
665 | 665 |
{ "enriched", ENRICHED }, |
... | ... |
@@ -912,6 +915,7 @@ parseEmailHeaders(const message *m, const table_t *rfc821) |
912 | 912 |
message *ret; |
913 | 913 |
bool anyHeadersFound = FALSE; |
914 | 914 |
bool Xheader = FALSE; |
915 |
+ int commandNumber = -1; |
|
915 | 916 |
|
916 | 917 |
cli_dbgmsg("parseEmailHeaders\n"); |
917 | 918 |
|
... | ... |
@@ -949,6 +953,14 @@ parseEmailHeaders(const message *m, const table_t *rfc821) |
949 | 949 |
#ifdef CL_THREAD_SAFE |
950 | 950 |
char *strptr; |
951 | 951 |
#endif |
952 |
+ switch(commandNumber) { |
|
953 |
+ case CONTENT_TRANSFER_ENCODING: |
|
954 |
+ case CONTENT_DISPOSITION: |
|
955 |
+ case CONTENT_TYPE: |
|
956 |
+ break; |
|
957 |
+ default: |
|
958 |
+ continue; |
|
959 |
+ } |
|
952 | 960 |
|
953 | 961 |
assert(strlen(buffer) < sizeof(copy)); |
954 | 962 |
strcpy(copy, buffer); |
... | ... |
@@ -964,10 +976,15 @@ parseEmailHeaders(const message *m, const table_t *rfc821) |
964 | 964 |
#endif |
965 | 965 |
} else { |
966 | 966 |
Xheader = (bool)(buffer[0] == 'X'); |
967 |
- messageAddArgument(ret, buffer); |
|
968 | 967 |
if((parseEmailHeader(ret, buffer, rfc821) >= 0) || |
969 |
- (strncasecmp(buffer, "From ", 5) == 0)) |
|
970 |
- anyHeadersFound = TRUE; |
|
968 |
+ (strncasecmp(buffer, "From ", 5) == 0)) { |
|
969 |
+ char cmd[LINE_LENGTH + 1]; |
|
970 |
+ |
|
971 |
+ if(cli_strtokbuf(buffer, 0, ":", cmd) != NULL) { |
|
972 |
+ anyHeadersFound = TRUE; |
|
973 |
+ commandNumber = tableFind(rfc821, cmd); |
|
974 |
+ } |
|
975 |
+ } |
|
971 | 976 |
} |
972 | 977 |
} else { |
973 | 978 |
/*cli_dbgmsg("Add line to body '%s'\n", buffer);*/ |