dovecot-2.2: lib-storage: Fixed off-by-one memory allocation in ...

dovecot at dovecot.org dovecot at dovecot.org
Wed Sep 3 13:30:31 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/3d9f233f5b77
changeset: 17760:3d9f233f5b77
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Sep 03 06:29:52 2014 -0700
description:
lib-storage: Fixed off-by-one memory allocation in dynamic settings allocation code.
This didn't actually affect normal Dovecot builds, because there were always
some storages with get_setting_parser_info=NULL that added the necessary
padding.

Patch by Michael M Slusarz

diffstat:

 src/lib-storage/mail-storage-settings.c |  3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diffs (20 lines):

diff -r d136c0869774 -r 3d9f233f5b77 src/lib-storage/mail-storage-settings.c
--- a/src/lib-storage/mail-storage-settings.c	Fri Aug 29 13:22:11 2014 +0900
+++ b/src/lib-storage/mail-storage-settings.c	Wed Sep 03 06:29:52 2014 -0700
@@ -322,7 +322,7 @@
 	unsigned int i, j, count;
 
 	storages = array_get(&mail_storage_classes, &count);
-	parsers = p_new(pool, struct dynamic_settings_parser, count + 1);
+	parsers = p_new(pool, struct dynamic_settings_parser, 1 + count + 1);
 	parsers[0].name = MAIL_STORAGE_SET_DRIVER_NAME;
 	parsers[0].info = &mail_storage_setting_parser_info;
 
@@ -334,6 +334,7 @@
 		parsers[j].info = storages[i]->v.get_setting_parser_info();
 		j++;
 	}
+	parsers[j] = NULL;
 	return parsers;
 }
 


More information about the dovecot-cvs mailing list