Browse code

Fix parsing error on mime arguments

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

Nigel Horne authored on 2004/09/20 21:44:03
Showing 2 changed files
... ...
@@ -17,6 +17,9 @@
17 17
  *
18 18
  * Change History:
19 19
  * $Log: mbox.c,v $
20
+ * Revision 1.133  2004/09/20 12:44:03  nigelhorne
21
+ * Fix parsing error on mime arguments
22
+ *
20 23
  * Revision 1.132  2004/09/20 08:31:56  nigelhorne
21 24
  * FOLLOWURLS now compiled if libcurl is found
22 25
  *
... ...
@@ -384,7 +387,7 @@
384 384
  * Compilable under SCO; removed duplicate code with message.c
385 385
  *
386 386
  */
387
-static	char	const	rcsid[] = "$Id: mbox.c,v 1.132 2004/09/20 08:31:56 nigelhorne Exp $";
387
+static	char	const	rcsid[] = "$Id: mbox.c,v 1.133 2004/09/20 12:44:03 nigelhorne Exp $";
388 388
 
389 389
 #if HAVE_CONFIG_H
390 390
 #include "clamav-config.h"
... ...
@@ -858,6 +861,7 @@ parseEmailHeaders(const message *m, const table_t *rfc821)
858 858
 				free(copy);
859 859
 			} else {
860 860
 				Xheader = (bool)(buffer[0] == 'X');
861
+				messageAddArgument(ret, buffer);
861 862
 				if((parseEmailHeader(ret, buffer, rfc821) >= 0) ||
862 863
 				   (strncasecmp(buffer, "From ", 5) == 0))
863 864
 					anyHeadersFound = TRUE;
... ...
@@ -2152,9 +2156,9 @@ parseMimeHeader(message *m, const char *cmd, const table_t *rfc821Table, const c
2152 2152
 				 */
2153 2153
 				cli_dbgmsg("Invalid content-type '%s' received, no subtype specified, assuming text/plain; charset=us-ascii\n", copy);
2154 2154
 			else {
2155
+				int i;
2155 2156
 				char *mimeArgs;	/* RHS of the ; */
2156 2157
 
2157
-				mimeArgs = cli_strtok(copy, 1, ";");
2158 2158
 				/*
2159 2159
 				 * Some clients are broken and
2160 2160
 				 * put white space after the ;
... ...
@@ -2234,7 +2238,10 @@ parseMimeHeader(message *m, const char *cmd, const table_t *rfc821Table, const c
2234 2234
 				 * Content-Type:', arg='multipart/mixed; boundary=foo
2235 2235
 				 * we find the boundary argument set it
2236 2236
 				 */
2237
-				if(mimeArgs) {
2237
+				i = 1;
2238
+				while((mimeArgs = cli_strtok(copy, i++, ";")) != NULL) {
2239
+					cli_dbgmsg("mimeArgs = '%s'\n", mimeArgs);
2240
+
2238 2241
 					messageAddArguments(m, mimeArgs);
2239 2242
 					free(mimeArgs);
2240 2243
 				}
... ...
@@ -17,6 +17,9 @@
17 17
  *
18 18
  * Change History:
19 19
  * $Log: message.c,v $
20
+ * Revision 1.87  2004/09/20 12:44:03  nigelhorne
21
+ * Fix parsing error on mime arguments
22
+ *
20 23
  * Revision 1.86  2004/09/18 14:59:26  nigelhorne
21 24
  * Code tidy
22 25
  *
... ...
@@ -255,7 +258,7 @@
255 255
  * uuencodebegin() no longer static
256 256
  *
257 257
  */
258
-static	char	const	rcsid[] = "$Id: message.c,v 1.86 2004/09/18 14:59:26 nigelhorne Exp $";
258
+static	char	const	rcsid[] = "$Id: message.c,v 1.87 2004/09/20 12:44:03 nigelhorne Exp $";
259 259
 
260 260
 #if HAVE_CONFIG_H
261 261
 #include "clamav-config.h"
... ...
@@ -574,8 +577,6 @@ messageAddArgument(message *m, const char *arg)
574 574
 	if(!usefulArg(arg))
575 575
 		return;
576 576
 
577
-	cli_dbgmsg("Add argument '%s'\n", arg);
578
-
579 577
 	for(offset = 0; offset < m->numberOfArguments; offset++)
580 578
 		if(m->mimeArguments[offset] == NULL)
581 579
 			break;