Browse code

Allow lowercase hex characters in quoted-printable

git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@1138 77e5149b-7576-45b1-b177-96237e5ba77b

Nigel Horne authored on 2004/11/29 01:24:12
Showing 1 changed files
... ...
@@ -17,6 +17,9 @@
17 17
  *
18 18
  * Change History:
19 19
  * $Log: message.c,v $
20
+ * Revision 1.124  2004/11/28 16:24:12  nigelhorne
21
+ * Allow lowercase hex characters in quoted-printable
22
+ *
20 23
  * Revision 1.123  2004/11/27 21:54:27  nigelhorne
21 24
  * Tidy
22 25
  *
... ...
@@ -366,7 +369,7 @@
366 366
  * uuencodebegin() no longer static
367 367
  *
368 368
  */
369
-static	char	const	rcsid[] = "$Id: message.c,v 1.123 2004/11/27 21:54:27 nigelhorne Exp $";
369
+static	char	const	rcsid[] = "$Id: message.c,v 1.124 2004/11/28 16:24:12 nigelhorne Exp $";
370 370
 
371 371
 #if HAVE_CONFIG_H
372 372
 #include "clamav-config.h"
... ...
@@ -440,7 +443,7 @@ static	const	struct	encoding_map {
440 440
 } encoding_map[] = {	/* rfc1521 */
441 441
 	{	"7bit",			NOENCODING	},
442 442
 	{	"text/plain",		NOENCODING	},
443
-	{	"quoted-printable",	QUOTEDPRINTABLE	},	/* rfc1522 */
443
+	{	"quoted-printable",	QUOTEDPRINTABLE	},	/* rfc1521 */
444 444
 	{	"base64",		BASE64		},	/* rfc2045 */
445 445
 	{	"8bit",			EIGHTBIT	},
446 446
 	{	"binary",		BINARY		},
... ...
@@ -2161,7 +2164,7 @@ decodeLine(message *m, encoding_type et, const char *line, unsigned char *buf, s
2161 2161
 					if((*++line == '\0') || (*line == '\n')) {
2162 2162
 						/*
2163 2163
 						 * broken e-mail, not
2164
-						 * adhering to RFC1522
2164
+						 * adhering to RFC1521
2165 2165
 						 */
2166 2166
 						*buf++ = byte;
2167 2167
 						break;
... ...
@@ -2471,9 +2474,12 @@ hex(char c)
2471 2471
 		return c - '0';
2472 2472
 	if((c >= 'A') && (c <= 'F'))
2473 2473
 		return c - 'A' + 10;
2474
+	if((c >= 'a') && (c <= 'f'))
2475
+		return c - 'a' + 10;
2476
+	cli_dbgmsg("Illegal hex character '%c'\n", c);
2474 2477
 
2475 2478
 	/*
2476
-	 * Some mails (notably some spam) break RFC1522 by failing to encode
2479
+	 * Some mails (notably some spam) break RFC1521 by failing to encode
2477 2480
 	 * the '=' character
2478 2481
 	 */
2479 2482
 	return '=';