dovecot-2.2: Data stack has now an extra NULL pointer padding be...

dovecot at dovecot.org dovecot at dovecot.org
Sun Nov 24 20:42:39 EET 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/2d2614769339
changeset: 17022:2d2614769339
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Nov 24 20:41:42 2013 +0200
description:
Data stack has now an extra NULL pointer padding before its actual data starts.
This is just an extra safety measure against buffer overflows.
Patch by Jann Horn.

diffstat:

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

diffs (21 lines):

diff -r 2b3541c3e262 -r 2d2614769339 src/lib/data-stack.c
--- a/src/lib/data-stack.c	Sun Nov 24 20:27:27 2013 +0200
+++ b/src/lib/data-stack.c	Sun Nov 24 20:41:42 2013 +0200
@@ -32,6 +32,9 @@
 	struct stack_block *next;
 
 	size_t size, left, lowwater;
+	/* always NULL and here just in case something accesses
+	   the memory in front of an allocated area */
+	char *nullpad;
 	/* unsigned char data[]; */
 };
 
@@ -299,6 +302,7 @@
 	block->left = 0;
 	block->lowwater = block->size;
 	block->next = NULL;
+	block->nullpad = NULL;
 
 #ifdef DEBUG
 	memset(STACK_BLOCK_DATA(block), CLEAR_CHR, alloc_size);


More information about the dovecot-cvs mailing list