Browse code

Handle unbalanced quote characters in headers better

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

Nigel Horne authored on 2004/11/30 21:07:42
Showing 2 changed files
... ...
@@ -1,17 +1,22 @@
1
+Tue Nov 30 12:06:12 GMT 2004 (njh)
2
+----------------------------------
3
+  * libclamav/message.c:	Better handling for  unbalanced quotes in
4
+			headers, e.g.  name="foo.doc
5
+
1 6
 Mon Nov 29 13:25:25 GMT 2004 (njh)
2 7
 ----------------------------------
3
-  * libclamav/blob.c:	Fix potential crash if a temporary file can't be
4
-		created
5
-    libclamav/mbox.c:	Disable the old continuation marker detection scheme
8
+* libclamav/blob.c:	Fix potential crash if a temporary file can't be
9
+	created
10
+libclamav/mbox.c:	Disable the old continuation marker detection scheme
6 11
 
7 12
 Mon Nov 29 00:23:55 CET 2004 (tk)
8 13
 ---------------------------------
9
-  * clamdscan: add support for --move and --remove options
14
+* clamdscan: add support for --move and --remove options
10 15
 
11 16
 Sun Nov 28 21:08:44 GMT 2004 (njh)
12 17
 ----------------------------------
13
-  * libclamav:	Email headers of only white space are no longer treated as
14
-			the end of the headers
18
+* libclamav:	Email headers of only white space are no longer treated as
19
+		the end of the headers
15 20
 
16 21
 Sun Nov 28 16:30:18 GMT 2004 (njh)
17 22
 ----------------------------------
... ...
@@ -17,6 +17,9 @@
17 17
  *
18 18
  * Change History:
19 19
  * $Log: message.c,v $
20
+ * Revision 1.127  2004/11/30 12:03:57  nigelhorne
21
+ * Handle unbalanced quote characters in headers better
22
+ *
20 23
  * Revision 1.126  2004/11/28 22:06:39  nigelhorne
21 24
  * Tidy space only headers code
22 25
  *
... ...
@@ -375,7 +378,7 @@
375 375
  * uuencodebegin() no longer static
376 376
  *
377 377
  */
378
-static	char	const	rcsid[] = "$Id: message.c,v 1.126 2004/11/28 22:06:39 nigelhorne Exp $";
378
+static	char	const	rcsid[] = "$Id: message.c,v 1.127 2004/11/30 12:03:57 nigelhorne Exp $";
379 379
 
380 380
 #if HAVE_CONFIG_H
381 381
 #include "clamav-config.h"
... ...
@@ -834,6 +837,9 @@ messageAddArguments(message *m, const char *s)
834 834
 
835 835
 		cptr = string++;
836 836
 
837
+		if(strlen(key) == 0)
838
+			continue;
839
+
837 840
 		if(*cptr == '"') {
838 841
 			char *ptr;
839 842
 
... ...
@@ -855,14 +861,11 @@ messageAddArguments(message *m, const char *s)
855 855
 
856 856
 			string = strchr(cptr, '"');
857 857
 
858
-			if((string == NULL) || (strlen(key) == 0)) {
859
-				if(usefulArg(key))
860
-					cli_warnmsg("Can't parse header (1) \"%s\" - report to bugs@clamav.net\n", s);
861
-				free((char *)key);
862
-				return;
863
-			}
864
-
865
-			string++;
858
+			if(string == NULL) {
859
+				cli_dbgmsg("Unbalanced quote character in \"%s\"\n", s);
860
+				string = "";
861
+			} else
862
+				string++;
866 863
 
867 864
 			if(!usefulArg(key)) {
868 865
 				free((char *)key);
... ...
@@ -884,7 +887,7 @@ messageAddArguments(message *m, const char *s)
884 884
 				 * TODO: the file should still be saved and
885 885
 				 * virus checked
886 886
 				 */
887
-				cli_warnmsg("Can't parse header (2) \"%s\"\n", s);
887
+				cli_dbgmsg("Can't parse header\"%s\" - report to bugs@clamav.net\n", s);
888 888
 				if(data)
889 889
 					free(data);
890 890
 				free((char *)key);