[PATCH 3/4] reformime: don't skip to the (last) Content-Type before parsing tokens from headers

Joshua Judson Rosen jrosen at harvestai.com
Thu Oct 2 18:12:06 UTC 2014


The tokens we're looking for (like "name") occur in Content-Disposition,
and Content-Disposition may actually occur ahead of, or in the absence of,
any Content-Type header; for example in multipart/form-data from an HTTP POST.

Signed-off-by: Joshua Judson Rosen <jrosen at harvestai.com>
---
 mailutils/reformime.c |   11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/mailutils/reformime.c b/mailutils/reformime.c
index 603f2bd..0f5d768 100644
--- a/mailutils/reformime.c
+++ b/mailutils/reformime.c
@@ -99,18 +99,11 @@ static int parse(const char *boundary, char **argv)
 
 		/* Split to tokens */
 		{
-			char *s, *p;
+			char *s;
 			unsigned ntokens;
 			const char *delims = ";=\" \t\n";
 
-			/* Skip to last Content-Type: */
-			s = p = header;
-			while ((p = strchr(p, '\n')) != NULL) {
-				p++;
-				if (strncasecmp(p, "Content-Type:", sizeof("Content-Type:")-1) == 0)
-					s = p;
-			}
-			dbg_error_msg("L:'%s'", p);
+			s = header;
 			ntokens = 0;
 			s = strtok(s, delims);
 			while (s) {
-- 
1.7.10.4



More information about the busybox mailing list