dovecot-1.2: array_idx_clear() was broken when clearing an index...

dovecot at dovecot.org dovecot at dovecot.org
Mon Apr 20 21:43:23 EEST 2009


details:   http://hg.dovecot.org/dovecot-1.2/rev/9ab0177cd004
changeset: 8972:9ab0177cd004
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Apr 20 14:43:15 2009 -0400
description:
array_idx_clear() was broken when clearing an index outside the existing array.

diffstat:

1 file changed, 2 insertions(+), 1 deletion(-)
src/lib/array.c |    3 ++-

diffs (13 lines):

diff -r 163c3f85a3aa -r 9ab0177cd004 src/lib/array.c
--- a/src/lib/array.c	Mon Apr 20 13:28:00 2009 -0400
+++ b/src/lib/array.c	Mon Apr 20 14:43:15 2009 -0400
@@ -35,7 +35,8 @@ void array_idx_clear_i(struct array *arr
 	pos = idx * array->element_size;
 	if (pos > array->buffer->used) {
 		/* index doesn't exist yet, initialize with zero */
-		buffer_append_zero(array->buffer, pos - array->buffer->used);
+		buffer_append_zero(array->buffer, pos - array->buffer->used +
+				   array->element_size);
 	} else {
 		buffer_write_zero(array->buffer, pos, array->element_size);
 	}


More information about the dovecot-cvs mailing list