dovecot: mail_get_headers() returned bad data when headers were ...

dovecot at dovecot.org dovecot at dovecot.org
Wed Nov 21 13:24:34 EET 2007


details:   http://hg.dovecot.org/dovecot/rev/e726f298d87e
changeset: 6838:e726f298d87e
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Nov 21 13:24:29 2007 +0200
description:
mail_get_headers() returned bad data when headers were already cached.
Dovecot doesn't use this function internally, but it might have caused
crashes with Sieve plugin.

diffstat:

1 file changed, 6 insertions(+), 8 deletions(-)
src/lib-storage/index/index-mail-headers.c |   14 ++++++--------

diffs (31 lines):

diff -r 6a6a224a2ceb -r e726f298d87e src/lib-storage/index/index-mail-headers.c
--- a/src/lib-storage/index/index-mail-headers.c	Tue Nov 20 22:36:34 2007 +0200
+++ b/src/lib-storage/index/index-mail-headers.c	Wed Nov 21 13:24:29 2007 +0200
@@ -553,8 +553,7 @@ index_mail_get_parsed_header(struct inde
 		}
 	}
 
-	value = NULL;
-	array_append(&header_values, &value, sizeof(value));
+	(void)array_append_space(&header_values);
 	return array_idx(&header_values, 0);
 }
 
@@ -623,12 +622,11 @@ index_mail_get_raw_headers(struct index_
 			value = (const char *)data + i;
 			i += len + 1;
 
-			array_append(&header_values, &value, sizeof(value));
-		}
-	}
-
-	value = NULL;
-	array_append(&header_values, &value, sizeof(value));
+			array_append(&header_values, &value, 1);
+		}
+	}
+
+	(void)array_append_space(&header_values);
 	*value_r = array_idx(&header_values, 0);
 	return 0;
 }


More information about the dovecot-cvs mailing list