git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@1080 77e5149b-7576-45b1-b177-96237e5ba77b
Nigel Horne authored on 2004/11/09 21:25:44... | ... |
@@ -1,3 +1,8 @@ |
1 |
+Tue Nov 9 12:25:20 GMT 2004 (njh) |
|
2 |
+---------------------------------- |
|
3 |
+ * libclamav/mbox.c: Better handling of mail-follow-urls when CURL is not |
|
4 |
+ installed |
|
5 |
+ |
|
1 | 6 |
Tue Nov 9 10:10:07 GMT 2004 (njh) |
2 | 7 |
---------------------------------- |
3 | 8 |
* libclamav/mbox.c: Basic handling for unbalanced quotes in the main |
... | ... |
@@ -17,6 +17,9 @@ |
17 | 17 |
* |
18 | 18 |
* Change History: |
19 | 19 |
* $Log: mbox.c,v $ |
20 |
+ * Revision 1.171 2004/11/09 12:24:32 nigelhorne |
|
21 |
+ * Better handling of mail-follow-urls when CURL is not installed |
|
22 |
+ * |
|
20 | 23 |
* Revision 1.170 2004/11/09 10:08:02 nigelhorne |
21 | 24 |
* Added basic handling of folded headers in the main message |
22 | 25 |
* |
... | ... |
@@ -498,7 +501,7 @@ |
498 | 498 |
* Compilable under SCO; removed duplicate code with message.c |
499 | 499 |
* |
500 | 500 |
*/ |
501 |
-static char const rcsid[] = "$Id: mbox.c,v 1.170 2004/11/09 10:08:02 nigelhorne Exp $"; |
|
501 |
+static char const rcsid[] = "$Id: mbox.c,v 1.171 2004/11/09 12:24:32 nigelhorne Exp $"; |
|
502 | 502 |
|
503 | 503 |
#if HAVE_CONFIG_H |
504 | 504 |
#include "clamav-config.h" |
... | ... |
@@ -3054,7 +3057,7 @@ checkURLs(message *m, const char *dir) |
3054 | 3054 |
} |
3055 | 3055 |
(void)tableInsert(t, url, 1); |
3056 | 3056 |
cli_dbgmsg("Downloading URL %s to be scanned\n", url); |
3057 |
- strncpy(name, url, sizeof(name)); |
|
3057 |
+ strncpy(name, url, sizeof(name) - 1); |
|
3058 | 3058 |
for(ptr = name; *ptr; ptr++) |
3059 | 3059 |
if(*ptr == '/') |
3060 | 3060 |
*ptr = '_'; |
... | ... |
@@ -3076,7 +3079,20 @@ checkURLs(message *m, const char *dir) |
3076 | 3076 |
/* |
3077 | 3077 |
* TODO: maximum size and timeouts |
3078 | 3078 |
*/ |
3079 |
- snprintf(cmd, sizeof(cmd) - 1, "GET -t10 %s > %s/%s 2>/dev/null", url, dir, name); |
|
3079 |
+ len = sizeof(cmd) - 26 - strlen(dir) - strlen(name); |
|
3080 |
+#ifdef CL_DEBUG |
|
3081 |
+ snprintf(cmd, sizeof(cmd) - 1, "GET -t10 %.*s >%s/%s", len, url, dir, name); |
|
3082 |
+#else |
|
3083 |
+ snprintf(cmd, sizeof(cmd) - 1, "GET -t10 %.*s >%s/%s 2>/dev/null", len, url, dir, name); |
|
3084 |
+#endif |
|
3085 |
+ cmd[sizeof(cmd) - 1] = '\0'; |
|
3086 |
+ |
|
3087 |
+#ifndef WITH_CURL |
|
3088 |
+ for(ptr = cmd; *ptr; ptr++) |
|
3089 |
+ if(strchr(";&", *ptr)) |
|
3090 |
+ *ptr = '_'; |
|
3091 |
+#endif |
|
3092 |
+ |
|
3080 | 3093 |
cli_dbgmsg("%s\n", cmd); |
3081 | 3094 |
#ifdef CL_THREAD_SAFE |
3082 | 3095 |
pthread_mutex_lock(&system_mutex); |