git-svn: trunk@1450
Nigel Horne authored on 2005/04/03 06:20:52... | ... |
@@ -1,3 +1,9 @@ |
1 |
+Sat Apr 2 22:19:12 BST 2005 (njh) |
|
2 |
+---------------------------------- |
|
3 |
+ * libclamav/tnef.c: Handle attachments where the data are before the title |
|
4 |
+ (bug report and samples thanks to Stefan |
|
5 |
+ Kaltenbrunner <stefan at kaltenbrunner.cc> |
|
6 |
+ |
|
1 | 7 |
Tue Mar 29 02:50:30 CEST 2005 (tk) |
2 | 8 |
---------------------------------- |
3 | 9 |
* libclamav/filetypes.c: try to detect international text data |
... | ... |
@@ -24,7 +24,7 @@ |
24 | 24 |
#include "clamav-config.h" |
25 | 25 |
#endif |
26 | 26 |
|
27 |
-static char const rcsid[] = "$Id: tnef.c,v 1.12 2005/03/26 18:32:51 nigelhorne Exp $"; |
|
27 |
+static char const rcsid[] = "$Id: tnef.c,v 1.13 2005/04/02 21:16:25 nigelhorne Exp $"; |
|
28 | 28 |
|
29 | 29 |
#include <stdio.h> |
30 | 30 |
|
... | ... |
@@ -119,6 +119,11 @@ cli_tnef(const char *dir, int desc) |
119 | 119 |
switch(i8) { |
120 | 120 |
case LVL_MESSAGE: |
121 | 121 |
/*cli_dbgmsg("TNEF - found message\n");*/ |
122 |
+ if(fb != NULL) { |
|
123 |
+ fileblobDestroy(fb); |
|
124 |
+ fb = NULL; |
|
125 |
+ } |
|
126 |
+ fb = fileblobCreate(); |
|
122 | 127 |
if(tnef_message(fp) != 0) { |
123 | 128 |
cli_errmsg("Error reading TNEF message\n"); |
124 | 129 |
ret = CL_EFORMAT; |
... | ... |
@@ -254,25 +259,22 @@ tnef_attachment(FILE *fp, const char *dir, fileblob **fbref) |
254 | 254 |
|
255 | 255 |
switch(tag) { |
256 | 256 |
case attATTACHTITLE: |
257 |
- if(*fbref != NULL) |
|
258 |
- fileblobDestroy(*fbref); |
|
259 |
- *fbref = fileblobCreate(); |
|
260 |
- |
|
261 |
- if(*fbref == NULL) |
|
262 |
- return -1; |
|
263 | 257 |
string = cli_malloc(length + 1); |
264 |
- |
|
265 | 258 |
if(fread(string, 1, length, fp) != length) |
266 | 259 |
return -1; |
267 | 260 |
string[length] = '\0'; |
268 | 261 |
cli_dbgmsg("TNEF filename %s\n", string); |
262 |
+ if(*fbref == NULL) { |
|
263 |
+ *fbref = fileblobCreate(); |
|
264 |
+ if(*fbref == NULL) |
|
265 |
+ return -1; |
|
266 |
+ } |
|
269 | 267 |
fileblobSetFilename(*fbref, dir, string); |
270 | 268 |
free(string); |
271 | 269 |
break; |
272 | 270 |
case attATTACHDATA: |
273 | 271 |
if(*fbref == NULL) { |
274 | 272 |
*fbref = fileblobCreate(); |
275 |
- |
|
276 | 273 |
if(*fbref == NULL) |
277 | 274 |
return -1; |
278 | 275 |
} |