git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@1048 77e5149b-7576-45b1-b177-96237e5ba77b
Nigel Horne authored on 2004/10/31 18:28:27... | ... |
@@ -17,6 +17,9 @@ |
17 | 17 |
* |
18 | 18 |
* Change History: |
19 | 19 |
* $Log: message.c,v $ |
20 |
+ * Revision 1.108 2004/10/31 09:28:27 nigelhorne |
|
21 |
+ * Improve the handling of blank filenames |
|
22 |
+ * |
|
20 | 23 |
* Revision 1.107 2004/10/24 03:51:48 nigelhorne |
21 | 24 |
* Change encoding guess from warn to debug |
22 | 25 |
* |
... | ... |
@@ -318,7 +321,7 @@ |
318 | 318 |
* uuencodebegin() no longer static |
319 | 319 |
* |
320 | 320 |
*/ |
321 |
-static char const rcsid[] = "$Id: message.c,v 1.107 2004/10/24 03:51:48 nigelhorne Exp $"; |
|
321 |
+static char const rcsid[] = "$Id: message.c,v 1.108 2004/10/31 09:28:27 nigelhorne Exp $"; |
|
322 | 322 |
|
323 | 323 |
#if HAVE_CONFIG_H |
324 | 324 |
#include "clamav-config.h" |
... | ... |
@@ -1537,7 +1540,7 @@ messageExport(message *m, const char *dir, void *(*create)(void), void (*destroy |
1537 | 1537 |
messageSetEncoding(m, "base64"); |
1538 | 1538 |
} |
1539 | 1539 |
|
1540 |
- (*setFilename)(ret, dir, (filename) ? filename : "attachment"); |
|
1540 |
+ (*setFilename)(ret, dir, (filename && *filename) ? filename : "attachment"); |
|
1541 | 1541 |
|
1542 | 1542 |
if(filename) |
1543 | 1543 |
free((char *)filename); |
... | ... |
@@ -1596,7 +1599,7 @@ messageExport(message *m, const char *dir, void *(*create)(void), void (*destroy |
1596 | 1596 |
} |
1597 | 1597 |
} |
1598 | 1598 |
|
1599 |
- (*setFilename)(ret, dir, (filename) ? filename : "attchment"); |
|
1599 |
+ (*setFilename)(ret, dir, (filename && *filename) ? filename : "attachment"); |
|
1600 | 1600 |
if(filename) { |
1601 | 1601 |
free((char *)filename); |
1602 | 1602 |
filename = NULL; |
... | ... |
@@ -1619,7 +1622,7 @@ messageExport(message *m, const char *dir, void *(*create)(void), void (*destroy |
1619 | 1619 |
messageSetEncoding(m, "base64"); |
1620 | 1620 |
} |
1621 | 1621 |
|
1622 |
- (*setFilename)(ret, dir, (filename) ? filename : "attchment"); |
|
1622 |
+ (*setFilename)(ret, dir, (filename && *filename) ? filename : "attachment"); |
|
1623 | 1623 |
|
1624 | 1624 |
t_line = messageGetBody(m); |
1625 | 1625 |
} |
... | ... |
@@ -2186,7 +2189,7 @@ sanitiseBase64(char *s) |
2186 | 2186 |
{ |
2187 | 2187 |
#ifdef USE_TABLE |
2188 | 2188 |
for(; *s; s++) |
2189 |
- if(base64Table[*s] == 255) { |
|
2189 |
+ if(base64Table[(int)*s] == 255) { |
|
2190 | 2190 |
char *p1; |
2191 | 2191 |
|
2192 | 2192 |
for(p1 = s; p1[0] != '\0'; p1++) |
... | ... |
@@ -2581,10 +2584,12 @@ simil(const char *str1, const char *str2) |
2581 | 2581 |
|
2582 | 2582 |
total += len2; |
2583 | 2583 |
|
2584 |
- if(push(&top, s1) == OUT_OF_MEMORY) |
|
2585 |
- return OUT_OF_MEMORY; |
|
2586 |
- if(push(&top, s2) == OUT_OF_MEMORY) |
|
2584 |
+ if((push(&top, s1) == OUT_OF_MEMORY) || |
|
2585 |
+ (push(&top, s2) == OUT_OF_MEMORY)) { |
|
2586 |
+ free(s1); |
|
2587 |
+ free(s2); |
|
2587 | 2588 |
return OUT_OF_MEMORY; |
2589 |
+ } |
|
2588 | 2590 |
|
2589 | 2591 |
while(pop(&top, ls2) == SUCCESS) { |
2590 | 2592 |
pop(&top, ls1); |