git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@952 77e5149b-7576-45b1-b177-96237e5ba77b
Nigel Horne authored on 2004/09/30 18:02:21... | ... |
@@ -1,3 +1,8 @@ |
1 |
+Thu Sep 30 10:01:25 BST 2004 (njh) |
|
2 |
+---------------------------------- |
|
3 |
+ * libclamav: Further small speed and size optimisations with MIME |
|
4 |
+ decoding |
|
5 |
+ |
|
1 | 6 |
Thu Sep 30 09:24:26 BST 2004 (trog) |
2 | 7 |
----------------------------------- |
3 | 8 |
* libclamav/special.c: match obfuscated JPEG files |
... | ... |
@@ -16,6 +16,9 @@ |
16 | 16 |
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
17 | 17 |
* |
18 | 18 |
* $Log: line.c,v $ |
19 |
+ * Revision 1.5 2004/09/30 08:58:56 nigelhorne |
|
20 |
+ * Remove empty lines |
|
21 |
+ * |
|
19 | 22 |
* Revision 1.4 2004/09/21 14:55:26 nigelhorne |
20 | 23 |
* Handle blank lines in text/plain messages |
21 | 24 |
* |
... | ... |
@@ -30,7 +33,7 @@ |
30 | 30 |
* |
31 | 31 |
*/ |
32 | 32 |
|
33 |
-static char const rcsid[] = "$Id: line.c,v 1.4 2004/09/21 14:55:26 nigelhorne Exp $"; |
|
33 |
+static char const rcsid[] = "$Id: line.c,v 1.5 2004/09/30 08:58:56 nigelhorne Exp $"; |
|
34 | 34 |
|
35 | 35 |
#if HAVE_CONFIG_H |
36 | 36 |
#include "clamav-config.h" |
... | ... |
@@ -113,11 +116,12 @@ line_t * |
113 | 113 |
lineLink(line_t *line) |
114 | 114 |
{ |
115 | 115 |
assert(line != NULL); |
116 |
- if(line[0] == 127) { |
|
117 |
- cli_warnmsg("lineLink: linkcount too large\n"); |
|
118 |
- return NULL; |
|
116 |
+ if((unsigned char)line[0] == 255) { |
|
117 |
+ cli_dbgmsg("lineLink: linkcount too large (%s)\n", lineGetData(line)); |
|
118 |
+ return lineCreate(lineGetData(line)); |
|
119 | 119 |
} |
120 | 120 |
line[0]++; |
121 |
+ /*printf("%d:\n\t'%s'\n", (int)line[0], &line[1]);*/ |
|
121 | 122 |
return line; |
122 | 123 |
} |
123 | 124 |
|
... | ... |
@@ -17,6 +17,9 @@ |
17 | 17 |
* |
18 | 18 |
* Change History: |
19 | 19 |
* $Log: message.c,v $ |
20 |
+ * Revision 1.92 2004/09/30 08:58:56 nigelhorne |
|
21 |
+ * Remove empty lines |
|
22 |
+ * |
|
20 | 23 |
* Revision 1.91 2004/09/28 18:39:48 nigelhorne |
21 | 24 |
* Don't copy if the decoded == the encoded |
22 | 25 |
* |
... | ... |
@@ -270,7 +273,7 @@ |
270 | 270 |
* uuencodebegin() no longer static |
271 | 271 |
* |
272 | 272 |
*/ |
273 |
-static char const rcsid[] = "$Id: message.c,v 1.91 2004/09/28 18:39:48 nigelhorne Exp $"; |
|
273 |
+static char const rcsid[] = "$Id: message.c,v 1.92 2004/09/30 08:58:56 nigelhorne Exp $"; |
|
274 | 274 |
|
275 | 275 |
#if HAVE_CONFIG_H |
276 | 276 |
#include "clamav-config.h" |
... | ... |
@@ -966,12 +969,31 @@ messageAddLine(message *m, line_t *line) |
966 | 966 |
int |
967 | 967 |
messageAddStr(message *m, const char *data) |
968 | 968 |
{ |
969 |
+ line_t *repeat = NULL; |
|
970 |
+ |
|
969 | 971 |
assert(m != NULL); |
970 | 972 |
|
973 |
+ if(data) { |
|
974 |
+ int isblank = 1; |
|
975 |
+ char *p; |
|
976 |
+ |
|
977 |
+ for(p = data; *p != '\0'; p++) |
|
978 |
+ if(!isspace(*p)) { |
|
979 |
+ isblank = 0; |
|
980 |
+ break; |
|
981 |
+ } |
|
982 |
+ if(isblank) { |
|
983 |
+ /*cli_dbgmsg("messageAddStr: empty line: '%s'\n", data);*/ |
|
984 |
+ data = NULL; |
|
985 |
+ } |
|
986 |
+ } |
|
987 |
+ |
|
971 | 988 |
if(m->body_first == NULL) |
972 | 989 |
m->body_last = m->body_first = (text *)cli_malloc(sizeof(text)); |
973 | 990 |
else { |
974 | 991 |
m->body_last->t_next = (text *)cli_malloc(sizeof(text)); |
992 |
+ if(data && m->body_last->t_line && (strcmp(data, lineGetData(m->body_last->t_line)) == 0)) |
|
993 |
+ repeat = m->body_last->t_line; |
|
975 | 994 |
m->body_last = m->body_last->t_next; |
976 | 995 |
} |
977 | 996 |
|
... | ... |
@@ -981,9 +1003,18 @@ messageAddStr(message *m, const char *data) |
981 | 981 |
m->body_last->t_next = NULL; |
982 | 982 |
|
983 | 983 |
if(data && *data) { |
984 |
- m->body_last->t_line = lineCreate(data); |
|
984 |
+ if(repeat) |
|
985 |
+ m->body_last->t_line = lineLink(repeat); |
|
986 |
+ else |
|
987 |
+ m->body_last->t_line = lineCreate(data); |
|
985 | 988 |
|
986 | 989 |
if(m->body_last->t_line == NULL) { |
990 |
+ /* |
|
991 |
+ * TODO: Here we could go through all the message |
|
992 |
+ * looking for duplicate lines we can line. It'd be |
|
993 |
+ * very slow, but it could save enough memory to |
|
994 |
+ * continue... |
|
995 |
+ */ |
|
987 | 996 |
cli_errmsg("messageAddStr: out of memory\n"); |
988 | 997 |
return -1; |
989 | 998 |
} |