dovecot-1.2: cache file: Don't crash if file has no fields.

dovecot at dovecot.org dovecot at dovecot.org
Thu Oct 16 16:19:55 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.2/rev/a0c05c33f838
changeset: 8282:a0c05c33f838
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Oct 16 16:19:37 2008 +0300
description:
cache file: Don't crash if file has no fields.

diffstat:

1 file changed, 2 insertions(+), 1 deletion(-)
src/lib-index/mail-cache-fields.c |    3 ++-

diffs (13 lines):

diff -r 3e34e1816ac1 -r a0c05c33f838 src/lib-index/mail-cache-fields.c
--- a/src/lib-index/mail-cache-fields.c	Thu Oct 16 15:59:35 2008 +0300
+++ b/src/lib-index/mail-cache-fields.c	Thu Oct 16 16:19:37 2008 +0300
@@ -155,7 +155,8 @@ mail_cache_register_get_list(struct mail
 	if (!cache->opened)
 		(void)mail_cache_open_and_verify(cache);
 
-	list = p_new(pool, struct mail_cache_field, cache->fields_count);
+	list = cache->fields_count == 0 ? NULL :
+		p_new(pool, struct mail_cache_field, cache->fields_count);
 	for (i = 0; i < cache->fields_count; i++) {
 		list[i] = cache->fields[i].field;
 		list[i].name = p_strdup(pool, list[i].name);


More information about the dovecot-cvs mailing list