git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@532 77e5149b-7576-45b1-b177-96237e5ba77b
Nigel Horne authored on 2004/04/29 18:01:16... | ... |
@@ -1,3 +1,9 @@ |
1 |
+Thu Apr 29 09:59:41 BST 2004 (njh) |
|
2 |
+---------------------------------- |
|
3 |
+ * libclamav: Tidied the handling of content disposition type: |
|
4 |
+ better handling of out of memory |
|
5 |
+ right chop white space |
|
6 |
+ |
|
1 | 7 |
Thu Apr 29 08:36:49 BST 2004 (njh) |
2 | 8 |
---------------------------------- |
3 | 9 |
* clamav-milter: Fixed typo, remove but introduced yesterday where the |
... | ... |
@@ -17,6 +17,9 @@ |
17 | 17 |
* |
18 | 18 |
* Change History: |
19 | 19 |
* $Log: mbox.c,v $ |
20 |
+ * Revision 1.68 2004/04/29 08:59:24 nigelhorne |
|
21 |
+ * Tidied up SetDispositionType |
|
22 |
+ * |
|
20 | 23 |
* Revision 1.67 2004/04/23 10:47:41 nigelhorne |
21 | 24 |
* If an inline text portion has a filename treat is as an attachment |
22 | 25 |
* |
... | ... |
@@ -192,7 +195,7 @@ |
192 | 192 |
* Compilable under SCO; removed duplicate code with message.c |
193 | 193 |
* |
194 | 194 |
*/ |
195 |
-static char const rcsid[] = "$Id: mbox.c,v 1.67 2004/04/23 10:47:41 nigelhorne Exp $"; |
|
195 |
+static char const rcsid[] = "$Id: mbox.c,v 1.68 2004/04/29 08:59:24 nigelhorne Exp $"; |
|
196 | 196 |
|
197 | 197 |
#if HAVE_CONFIG_H |
198 | 198 |
#include "clamav-config.h" |
... | ... |
@@ -256,7 +259,6 @@ static int endOfMessage(const char *line, const char *boundary); |
256 | 256 |
static int initialiseTables(table_t **rfc821Table, table_t **subtypeTable); |
257 | 257 |
static int getTextPart(message *const messages[], size_t size); |
258 | 258 |
static size_t strip(char *buf, int len); |
259 |
-static size_t strstrip(char *s); |
|
260 | 259 |
static bool continuationMarker(const char *line); |
261 | 260 |
static int parseMimeHeader(message *m, const char *cmd, const table_t *rfc821Table, const char *arg); |
262 | 261 |
static void saveTextPart(message *m, const char *dir); |
... | ... |
@@ -1665,7 +1667,7 @@ strip(char *buf, int len) |
1665 | 1665 |
* strstrip: |
1666 | 1666 |
* Strip a given string |
1667 | 1667 |
*/ |
1668 |
-static size_t |
|
1668 |
+size_t |
|
1669 | 1669 |
strstrip(char *s) |
1670 | 1670 |
{ |
1671 | 1671 |
if(s == (char *)NULL) |
... | ... |
@@ -17,6 +17,9 @@ |
17 | 17 |
* |
18 | 18 |
* Change History: |
19 | 19 |
* $Log: message.c,v $ |
20 |
+ * Revision 1.53 2004/04/29 08:59:24 nigelhorne |
|
21 |
+ * Tidied up SetDispositionType |
|
22 |
+ * |
|
20 | 23 |
* Revision 1.52 2004/04/05 12:04:56 nigelhorne |
21 | 24 |
* Scan attachments with no filename |
22 | 25 |
* |
... | ... |
@@ -153,7 +156,7 @@ |
153 | 153 |
* uuencodebegin() no longer static |
154 | 154 |
* |
155 | 155 |
*/ |
156 |
-static char const rcsid[] = "$Id: message.c,v 1.52 2004/04/05 12:04:56 nigelhorne Exp $"; |
|
156 |
+static char const rcsid[] = "$Id: message.c,v 1.53 2004/04/29 08:59:24 nigelhorne Exp $"; |
|
157 | 157 |
|
158 | 158 |
#if HAVE_CONFIG_H |
159 | 159 |
#include "clamav-config.h" |
... | ... |
@@ -358,17 +361,25 @@ messageSetDispositionType(message *m, const char *disptype) |
358 | 358 |
{ |
359 | 359 |
assert(m != NULL); |
360 | 360 |
|
361 |
+ if(m->mimeDispositionType) |
|
362 |
+ free(m->mimeDispositionType); |
|
363 |
+ if(disptype == NULL) { |
|
364 |
+ m->mimeDispositionType = NULL; |
|
365 |
+ return; |
|
366 |
+ } |
|
367 |
+ |
|
361 | 368 |
/* |
362 | 369 |
* It's broken for there to be an entry such as "Content-Disposition:" |
363 | 370 |
* However some spam and viruses are rather broken, it's a sign |
364 | 371 |
* that something is wrong if we get that - maybe we should force a |
365 | 372 |
* scan of this part |
366 | 373 |
*/ |
367 |
- if(disptype) { |
|
368 |
- while(isspace((int)*disptype)) |
|
369 |
- disptype++; |
|
370 |
- if(*disptype) |
|
371 |
- m->mimeDispositionType = strdup(disptype); |
|
374 |
+ while(*disptype && isspace((int)*disptype)) |
|
375 |
+ disptype++; |
|
376 |
+ if(*disptype) { |
|
377 |
+ m->mimeDispositionType = strdup(disptype); |
|
378 |
+ if(m->mimeDispositionType) |
|
379 |
+ strstrip(m->mimeDispositionType); |
|
372 | 380 |
} |
373 | 381 |
} |
374 | 382 |
|