[evolution-patches] camel_folder_summary_decode_token len bug



As discussed on IRC, camel/camel-folder-summary.c's
camel_folder_summary_decode_token is not consistent with whatever writes
the summary files.  In particular reading an actual length of 0 (encoded
as 32) is treated as an error despite apparently being written to the
file for at least one of the messages in my large in box.

Symptoms:  Every time the summary file is read it is deemed to be
corrupt and all of the summary information is re-fetched from the (in my
case) IMAP server.

The attached patch, authored by NotZed, is a fix for this that works for
me at least.

Thanks!
Index: camel/camel-folder-summary.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/camel-folder-summary.c,v
retrieving revision 1.136
diff -u -3 -r1.136 camel-folder-summary.c
--- camel/camel-folder-summary.c	17 May 2004 03:44:27 -0000	1.136
+++ camel/camel-folder-summary.c	20 Sep 2004 10:07:26 -0000
@@ -1363,7 +1363,7 @@
 	} else {
 		len -= 32;
 		ret = g_malloc(len+1);
-		if (fread(ret, len, 1, in) != 1) {
+		if (len > 0 && fread(ret, len, 1, in) != 1) {
 			g_free(ret);
 			*str = NULL;
 			return -1;


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