dovecot: Fixed buffer overflow checking code.

dovecot at dovecot.org dovecot at dovecot.org
Sat Dec 29 05:37:30 EET 2007


details:   http://hg.dovecot.org/dovecot/rev/c751ec28b869
changeset: 7052:c751ec28b869
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Dec 29 05:37:27 2007 +0200
description:
Fixed buffer overflow checking code.

diffstat:

1 file changed, 3 insertions(+)
src/lib/data-stack.c |    3 +++

diffs (13 lines):

diff -r 1d37d2997220 -r c751ec28b869 src/lib/data-stack.c
--- a/src/lib/data-stack.c	Sat Dec 29 05:28:51 2007 +0200
+++ b/src/lib/data-stack.c	Sat Dec 29 05:37:27 2007 +0200
@@ -353,6 +353,9 @@ static void *t_malloc_real(size_t size, 
 #ifdef DEBUG
 	memcpy(ret, &size, sizeof(size));
 	ret = PTR_OFFSET(ret, MEM_ALIGN(sizeof(size)));
+	/* make sure the sentry contains CLEAR_CHRs. it might not if we
+	   had used t_buffer_get(). */
+	memset(PTR_OFFSET(ret, size), CLEAR_CHR, SENTRY_COUNT);
 #endif
         return ret;
 }


More information about the dovecot-cvs mailing list