dovecot-2.0: dsync: Fixed crash when mailbox had zero cache_fiel...

dovecot at dovecot.org dovecot at dovecot.org
Sun Jan 16 18:53:46 EET 2011


details:   http://hg.dovecot.org/dovecot-2.0/rev/113b54dcb950
changeset: 12562:113b54dcb950
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Jan 16 18:53:27 2011 +0200
description:
dsync: Fixed crash when mailbox had zero cache_fields but its array was initialized.

diffstat:

 src/dsync/dsync-data.c |  4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diffs (14 lines):

diff -r af92646d36d6 -r 113b54dcb950 src/dsync/dsync-data.c
--- a/src/dsync/dsync-data.c	Thu Jan 13 13:18:20 2011 +0200
+++ b/src/dsync/dsync-data.c	Sun Jan 16 18:53:27 2011 +0200
@@ -19,7 +19,9 @@
 
 	if (array_is_created(&box->cache_fields))
 		cache_fields = array_get(&box->cache_fields, &count);
-	if (count > 0) {
+	if (count == 0)
+		memset(&dest->cache_fields, 0, sizeof(dest->cache_fields));
+	else {
 		p_array_init(&dest->cache_fields, pool, count);
 		for (i = 0; i < count; i++) {
 			dup = p_strdup(pool, cache_fields[i]);


More information about the dovecot-cvs mailing list