dovecot-2.2: lib-fs: Added asserts to fs_set_metadata() to make ...

dovecot at dovecot.org dovecot at dovecot.org
Tue Nov 17 14:30:42 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/d39daee9d72c
changeset: 19381:d39daee9d72c
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Nov 17 16:30:16 2015 +0200
description:
lib-fs: Added asserts to fs_set_metadata() to make sure key and value are non-NULL
Otherwise the bug would be noticed only much later when trying to
dereference NULL pointer.

diffstat:

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

diffs (13 lines):

diff -r 6bf404e276c6 -r d39daee9d72c src/lib-fs/fs-api.c
--- a/src/lib-fs/fs-api.c	Tue Nov 17 11:51:45 2015 +0200
+++ b/src/lib-fs/fs-api.c	Tue Nov 17 16:30:16 2015 +0200
@@ -302,6 +302,9 @@
 
 void fs_set_metadata(struct fs_file *file, const char *key, const char *value)
 {
+	i_assert(key != NULL);
+	i_assert(value != NULL);
+
 	if (file->fs->v.set_metadata != NULL) T_BEGIN {
 		file->fs->v.set_metadata(file, key, value);
 		file->metadata_changed = TRUE;


More information about the dovecot-cvs mailing list