evolution-data-server r8599 - trunk/camel



Author: mcrha
Date: Mon Mar 31 10:40:31 2008
New Revision: 8599
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=8599&view=rev

Log:
2008-03-31  Milan Crha  <mcrha redhat com>

	** Fix for bug #524704

	* camel-mime-utils.c: (quoted_decode):
	Allow direct spaces in a string.
	* camel-mime-utils.c: (rfc2047_decode_word):
	Do not return empty string in case of malformed text.
	* camel-mime-utils.c: (header_decode_text):
	Be sure we access only allocated memory.



Modified:
   trunk/camel/ChangeLog
   trunk/camel/camel-mime-utils.c

Modified: trunk/camel/camel-mime-utils.c
==============================================================================
--- trunk/camel/camel-mime-utils.c	(original)
+++ trunk/camel/camel-mime-utils.c	Mon Mar 31 10:40:31 2008
@@ -741,10 +741,6 @@
 			}
 		} else if (c=='_') {
 			*outptr++ = 0x20;
-		} else if (c==' ' || c==0x09) {
-			/* FIXME: this is an error! ignore for now ... */
-			ret = -1;
-			break;
 		} else {
 			*outptr++ = c;
 		}
@@ -1084,7 +1080,11 @@
 		d(fprintf (stderr, "unknown encoding\n"));
 		return NULL;
 	}
-	
+
+	/* never return empty string, return rather NULL */
+	if (!declen)
+		return NULL;
+
 	len = (inptr - 3) - (instart + 2);
 	charenc = g_alloca (len + 1);
 	memcpy (charenc, in + 2, len);
@@ -1101,7 +1101,7 @@
 	/* trim off the 'language' part if it's there... */
 	if ((p = strchr (charset, '*')))
 		*p = '\0';
-	
+
 	/* slight optimization? */
 	if (!g_ascii_strcasecmp (charset, "UTF-8")) {
 		p = (char *) decoded;
@@ -1248,7 +1248,7 @@
 				}
 				
 				/* sanity check encoding type */
-				if (inptr[0] != '?' || !strchr ("BbQq", inptr[1]) || inptr[2] != '?')
+				if (inptr[0] != '?' || !strchr ("BbQq", inptr[1]) || !inptr[1] || inptr[2] != '?')
 					goto non_rfc2047;
 				
 				inptr += 3;



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