dovecot-2.2: lib: buffer - paranoid compile-time check for struc...

dovecot at dovecot.org dovecot at dovecot.org
Wed Mar 18 15:11:22 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/3ed51d56e2a3
changeset: 18368:3ed51d56e2a3
user:      Phil Carmody <phil at dovecot.fi>
date:      Wed Mar 18 17:10:23 2015 +0200
description:
lib: buffer - paranoid compile-time check for struct sizes
At the moment, nothing guarantees that the public struct is big
enough to contain the private struct.

Signed-off-by: Phil Carmody <phil at dovecot.fi>

diffstat:

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

diffs (11 lines):

diff -r 30953774f034 -r 3ed51d56e2a3 src/lib/buffer.c
--- a/src/lib/buffer.c	Wed Mar 18 17:10:03 2015 +0200
+++ b/src/lib/buffer.c	Wed Mar 18 17:10:23 2015 +0200
@@ -19,6 +19,7 @@
 	unsigned int alloced:1;
 	unsigned int dynamic:1;
 };
+typedef int buffer_check_sizes[COMPILE_ERROR_IF_TRUE(sizeof(struct real_buffer) > sizeof(buffer_t)) ?1:1];
 
 static void buffer_alloc(struct real_buffer *buf, size_t size)
 {


More information about the dovecot-cvs mailing list