[evolution-patches] fixes for uuencode bugs (48345 and 48184)



ok, 2 down... 297 more to go.

-- 
Jeffrey Stedfast
Evolution Hacker - Ximian, Inc.
fejj ximian com  - www.ximian.com
? 48345-and-48148.patch
? idate
? idate.c
? uudecode.patch
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.2761.2.21
diff -u -r1.2761.2.21 ChangeLog
--- ChangeLog	4 Jan 1997 07:20:10 -0000	1.2761.2.21
+++ ChangeLog	11 Sep 2003 18:17:58 -0000
@@ -1,3 +1,12 @@
+2003-09-11  Jeffrey Stedfast  <fejj ximian com>
+
+	* mail-format.c (handle_text_plain): Don't set inend until after
+	we've appended the '\n', this fixes bug #48345. Instead of passing
+	inend to handle_uuencode(), scan for a "\nend\n" and use that as
+	the max end boundary - fixes bug #48184. Also don't bother
+	checking lineptr against "begin ..." if inptr == inend, since it
+	couldn't possibly be the start of a uuencoded blob.
+
 2003-09-10  Jeffrey Stedfast  <fejj ximian com>
 
 	* mail-account-gui.c (mail_account_gui_save): Allow the user to
Index: mail-format.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-format.c,v
retrieving revision 1.287.2.1
diff -u -r1.287.2.1 mail-format.c
--- mail-format.c	3 Sep 2003 18:07:58 -0000	1.287.2.1
+++ mail-format.c	11 Sep 2003 18:17:59 -0000
@@ -1262,7 +1262,12 @@
 			 * encounters the end of the encoded data, not
 			 * when it encounters "^end\n" so we need to
 			 * check the next line and if it is "end\n",
-			 * then skip it. */
+			 * then skip it (or, if it is a "`\n" we need
+			 * to skip that and then check the next line
+			 * for "end\n").
+			 */
+			
+		uu_end:
 			if (inptr < inend) {
 				lineptr = inptr;
 				
@@ -1274,6 +1279,8 @@
 				
 				if (strncmp (lineptr, "end\n", 4) != 0)
 					inptr = lineptr;
+				else if (strncmp (lineptr, "`\n", 2) == 0)
+					goto uu_end;
 			}
 			
 			break;
@@ -1358,6 +1365,7 @@
 		
 		inend = text->data + text->len;
 		g_byte_array_append (text, "\n", 1);
+		inend = text->data + text->len - 1;
 		inptr = text->data;
 		
 		while (inptr < inend) {
@@ -1366,8 +1374,10 @@
 			while (*inptr != '\n')
 				inptr++;
 			
-			if (inptr != inend)
-				inptr++;
+			if (inptr == inend)
+				goto plain_text;
+			
+			inptr++;
 			
 			if (!strncmp (lineptr, "begin ", 6) && lineptr[6] >= '0' && lineptr[6] <= '7') {
 				const char *q, *p = lineptr + 7;
@@ -1392,7 +1402,12 @@
 				camel_stream_write_string ((CamelStream *) stream, "</tt></td></tr></table>\n");
 				
 				/* create the fake part... */
-				uu_part = handle_uuencode (&inptr, inend);
+				if (!(q = strstr (inptr, "\nend\n")))
+					q = inend;
+				else
+					q += 5;
+				
+				uu_part = handle_uuencode (&inptr, q);
 				camel_mime_part_set_filename (uu_part, filename);
 				g_free (filename);
 				


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