Browse code

Binxhex detection speeded up

git-svn: trunk@1089

Nigel Horne authored on 2004/11/13 07:21:57
Showing 1 changed files
... ...
@@ -17,6 +17,9 @@
17 17
  *
18 18
  * Change History:
19 19
  * $Log: message.c,v $
20
+ * Revision 1.115  2004/11/12 22:21:57  nigelhorne
21
+ * Binxhex detection speeded up
22
+ *
20 23
  * Revision 1.114  2004/11/12 09:03:26  nigelhorne
21 24
  * Parse some malformed binhex files
22 25
  *
... ...
@@ -339,7 +342,7 @@
339 339
  * uuencodebegin() no longer static
340 340
  *
341 341
  */
342
-static	char	const	rcsid[] = "$Id: message.c,v 1.114 2004/11/12 09:03:26 nigelhorne Exp $";
342
+static	char	const	rcsid[] = "$Id: message.c,v 1.115 2004/11/12 22:21:57 nigelhorne Exp $";
343 343
 
344 344
 #if HAVE_CONFIG_H
345 345
 #include "clamav-config.h"
... ...
@@ -1222,7 +1225,13 @@ messageIsEncoding(message *m)
1222 1222
 		(line[9] == ' ')))
1223 1223
 			m->uuencode = m->body_last;
1224 1224
 	else if((m->binhex == NULL) &&
1225
+		strstr(line, "BinHex") &&
1225 1226
 		(simil(line, binhex) > 90))
1227
+			/*
1228
+			 * Look for close matches for BinHex, but
1229
+			 * simil() is expensive so only do it if it's
1230
+			 * likely to be found
1231
+			 */
1226 1232
 			m->binhex = m->body_last;
1227 1233
 	else if((m->yenc == NULL) && (strncmp(line, "=ybegin line=", 13) == 0))
1228 1234
 		m->yenc = m->body_last;
... ...
@@ -1588,7 +1597,7 @@ messageExport(message *m, const char *dir, void *(*create)(void), void (*destroy
1588 1588
 			if(t_line == NULL) {
1589 1589
 				/*cli_warnmsg("UUENCODED attachment is missing begin statement\n");*/
1590 1590
 				(*destroy)(ret);
1591
-				m->base64chars = NULL;
1591
+				m->base64chars = 0;
1592 1592
 				return NULL;
1593 1593
 			}
1594 1594
 
... ...
@@ -2154,9 +2163,11 @@ decodeLine(message *m, encoding_type et, const char *line, unsigned char *buf, s
2154 2154
 			 * Klez doesn't always put "=" on the last line
2155 2155
 			 */
2156 2156
 			buf = decode(m, copy, buf, base64, (p2 == NULL) && ((strlen(copy) & 3) == 0));
2157
+#if	0
2157 2158
 			if(p2)
2158 2159
 				/* flush the read ahead bytes */
2159 2160
 				buf = decode(m, NULL, buf, base64, FALSE);
2161
+#endif
2160 2162
 
2161 2163
 			/*buf = decode(m, copy, buf, base64, FALSE);*/
2162 2164