[gmime/gmime-2-4] Modified param value parser to be less strict



commit 7125ea7bef5c562b11541ae45687462e984e7b7e
Author: Jeffrey Stedfast <fejj gnome org>
Date:   Mon Aug 30 21:02:14 2010 -0400

    Modified param value parser to be less strict
    
    2010-08-30  Jeffrey Stedfast  <fejj novell com>
    
    	* gmime/gmime-param.c (decode_token): Make less strict in order
    	* to
    	handle unquoted boundary values containing '=' (and other
    illegal
    	characters).

 ChangeLog           |    8 +++++++-
 gmime/gmime-param.c |   13 +++++++++++++
 2 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b03da84..aeb90a3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-08-30  Jeffrey Stedfast  <fejj novell com>
+
+	* gmime/gmime-param.c (decode_token): Make less strict in order to
+	handle unquoted boundary values containing '=' (and other illegal
+	characters).
+
 2010-08-27  Jeffrey Stedfast  <fejj novell com>
 
 	* README: Bumped version
@@ -10,7 +16,7 @@
 
 	* gmime/internet-address.c (_internet_address_set_name): Don't
 	decode/unquote the name. The docs for all the functions that call
-	this asume the name string is in its decoded form already.
+	this assume the name string is in its decoded form already.
 	(_internet_address_decode_name): New internal function that
 	decodes a string and sets it as the name on the InternetAddress.
 	(decode_address): Rewritten to be even more liberal in what it
diff --git a/gmime/gmime-param.c b/gmime/gmime-param.c
index 5d3e3bf..7a1f68a 100644
--- a/gmime/gmime-param.c
+++ b/gmime/gmime-param.c
@@ -173,8 +173,21 @@ decode_token (const char **in)
 	decode_lwsp (&inptr);
 	
 	start = inptr;
+#ifdef STRICT_PARSER
 	while (is_ttoken (*inptr))
 		inptr++;
+#else
+	/* Broken mail clients like to make our lives difficult. Scan
+	 * for a ';' instead of trusting that the client followed the
+	 * specification. */
+	while (*inptr && *inptr != ';')
+		inptr++;
+	
+	/* Scan backwards over any trailing lwsp */
+	while (inptr > start && is_lwsp (inptr[-1]))
+		inptr--;
+#endif
+	
 	if (inptr > start) {
 		*in = inptr;
 		return g_strndup (start, (size_t) (inptr - start));



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]