dovecot-2.2: lib: array - additional compile-time checks to arra...

dovecot at dovecot.org dovecot at dovecot.org
Tue Nov 25 01:54:20 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/b7074256cc65
changeset: 18115:b7074256cc65
user:      Phil Carmody <phil at dovecot.fi>
date:      Tue Nov 25 03:48:42 2014 +0200
description:
lib: array - additional compile-time checks to array_append
The new two-array helper macro works in this context too.

Note: array_copy doesn't have any protection currently, it isn't
obvious how to wrap that with some safety without breaking interfaces.
It only seems to have one internal user, lib/aqueue.

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

diffstat:

 src/lib/array.h |  3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diffs (13 lines):

diff -r e9ac32255ef1 -r b7074256cc65 src/lib/array.h
--- a/src/lib/array.h	Tue Nov 25 03:45:35 2014 +0200
+++ b/src/lib/array.h	Tue Nov 25 03:48:42 2014 +0200
@@ -164,7 +164,8 @@
 	buffer_append_buf(dest_array->buffer, src_array->buffer, 0, (size_t)-1);
 }
 #define array_append_array(dest_array, src_array) \
-	array_append_array_i(&(dest_array)->arr, &(src_array)->arr)
+	array_append_array_i(&(dest_array)->arr + ARRAY_TYPES_CHECK(dest_array, src_array), \
+			     &(src_array)->arr)
 
 static inline void
 array_insert_i(struct array *array, unsigned int idx,


More information about the dovecot-cvs mailing list