git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@171 77e5149b-7576-45b1-b177-96237e5ba77b
Nigel Horne authored on 2004/01/06 23:43:17... | ... |
@@ -1,3 +1,8 @@ |
1 |
+Tue Jan 6 14:42:00 GMT 2004 (njh) |
|
2 |
+---------------------------------- |
|
3 |
+ * libclamav: Handle headers which do not not have a space after the ':' |
|
4 |
+ Example mail submitted by "Diego d'Ambra" <da@softcom.dk> |
|
5 |
+ |
|
1 | 6 |
Tue Jan 6 14:43:42 CET 2004 (tk) |
2 | 7 |
--------------------------------- |
3 | 8 |
* clamd: cfgfile.c: HTTPProxyPort is now OPT_NUM and not OPT_STR (the bug |
... | ... |
@@ -17,6 +17,9 @@ |
17 | 17 |
* |
18 | 18 |
* Change History: |
19 | 19 |
* $Log: mbox.c,v $ |
20 |
+ * Revision 1.25 2004/01/06 14:41:18 nigelhorne |
|
21 |
+ * Handle headers which do not not have a space after the ':' |
|
22 |
+ * |
|
20 | 23 |
* Revision 1.24 2003/12/20 13:55:36 nigelhorne |
21 | 24 |
* Ensure multipart just save the bodies of attachments |
22 | 25 |
* |
... | ... |
@@ -63,7 +66,7 @@ |
63 | 63 |
* Compilable under SCO; removed duplicate code with message.c |
64 | 64 |
* |
65 | 65 |
*/ |
66 |
-static char const rcsid[] = "$Id: mbox.c,v 1.24 2003/12/20 13:55:36 nigelhorne Exp $"; |
|
66 |
+static char const rcsid[] = "$Id: mbox.c,v 1.25 2004/01/06 14:41:18 nigelhorne Exp $"; |
|
67 | 67 |
|
68 | 68 |
#ifndef CL_DEBUG |
69 | 69 |
/*#define NDEBUG /* map CLAMAV debug onto standard */ |
... | ... |
@@ -374,14 +377,40 @@ parseEmailHeaders(const message *m, const table_t *rfc821Table) |
374 | 374 |
inHeader = FALSE; |
375 | 375 |
} else { |
376 | 376 |
const bool isLastLine = !continuationMarker(buffer); |
377 |
- const char *cmd = strtok_r(buffer, " \t", &strptr); |
|
377 |
+ char *cmd = strtok_r(buffer, " \t", &strptr); |
|
378 | 378 |
|
379 |
- if(cmd && *cmd) { |
|
380 |
- const char *arg = strtok_r(NULL, "", &strptr); |
|
379 |
+ if(*cmd) { |
|
380 |
+ char *arg = strtok_r(NULL, "", &strptr); |
|
381 | 381 |
|
382 |
- if(arg) |
|
382 |
+ if(arg) { |
|
383 |
+ /* |
|
384 |
+ * Found a header such as |
|
385 |
+ * Content-Type: multipart/mixed; |
|
386 |
+ * set arg to be |
|
387 |
+ * "multipart/mixed" and cmd to |
|
388 |
+ * be "Content-Type:" |
|
389 |
+ */ |
|
383 | 390 |
if(parseMimeHeader(ret, cmd, rfc821Table, arg) == CONTENT_TYPE) |
384 | 391 |
inContinuationHeader = !isLastLine; |
392 |
+ } else { |
|
393 |
+ /* |
|
394 |
+ * Handle the case where the |
|
395 |
+ * header does not have a space |
|
396 |
+ * after the ':', e.g. |
|
397 |
+ * Content-Type:multipart/mixed; |
|
398 |
+ */ |
|
399 |
+ arg = strchr(cmd, ':'); |
|
400 |
+ if(arg && (*++arg != '\0')) { |
|
401 |
+ char *p; |
|
402 |
+ |
|
403 |
+ cmd = strdup(cmd); |
|
404 |
+ p = strchr(cmd, ':'); |
|
405 |
+ *++p = '\0'; |
|
406 |
+ if(parseMimeHeader(ret, cmd, rfc821Table, arg) == CONTENT_TYPE) |
|
407 |
+ inContinuationHeader = !isLastLine; |
|
408 |
+ free(cmd); |
|
409 |
+ } |
|
410 |
+ } |
|
385 | 411 |
} |
386 | 412 |
} |
387 | 413 |
} else |