dovecot-2.2: buffer_create_data(): Clear the memory area immedia...

dovecot at dovecot.org dovecot at dovecot.org
Thu Sep 6 01:05:28 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/34076ab28d28
changeset: 15033:34076ab28d28
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Sep 06 01:04:57 2012 +0300
description:
buffer_create_data(): Clear the memory area immediately.

diffstat:

 src/lib/buffer.c |  4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diffs (14 lines):

diff -r 5930f7812e28 -r 34076ab28d28 src/lib/buffer.c
--- a/src/lib/buffer.c	Thu Sep 06 01:04:28 2012 +0300
+++ b/src/lib/buffer.c	Thu Sep 06 01:04:57 2012 +0300
@@ -96,6 +96,10 @@
 	memset(buf, 0, sizeof(*buf));
 	buf->alloc = size;
 	buf->r_buffer = buf->w_buffer = data;
+	/* clear the whole memory area. unnecessary usually, but if the
+	   buffer is used by e.g. str_c() it tries to access uninitialized
+	   memory */
+	memset(data, 0, size);
 }
 
 void buffer_create_const_data(buffer_t *buffer, const void *data, size_t size)


More information about the dovecot-cvs mailing list