dovecot-2.0: mail_index_get_keywords() / status.keywords weren't...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Aug 4 19:57:46 EEST 2011
details: http://hg.dovecot.org/dovecot-2.0/rev/ba03935cc599
changeset: 12875:ba03935cc599
user: Timo Sirainen <tss at iki.fi>
date: Thu Aug 04 19:57:35 2011 +0300
description:
mail_index_get_keywords() / status.keywords weren't actually guaranteed to be NULL terminated
This could have caused crashes or garbage keywords be presented to clients
in some situations.
diffstat:
src/lib-index/mail-index.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diffs (14 lines):
diff -r d7f76c266657 -r ba03935cc599 src/lib-index/mail-index.c
--- a/src/lib-index/mail-index.c Tue Aug 02 13:29:47 2011 +0300
+++ b/src/lib-index/mail-index.c Thu Aug 04 19:57:35 2011 +0300
@@ -265,6 +265,10 @@
hash_table_insert(index->keywords_hash,
keyword_dup, POINTER_CAST(*idx_r));
array_append(&index->keywords, &keyword, 1);
+
+ /* keep the array NULL-terminated, but the NULL itself invisible */
+ (void)array_append_space(&index->keywords);
+ array_delete(&index->keywords, array_count(&index->keywords)-1, 1);
}
const ARRAY_TYPE(keywords) *mail_index_get_keywords(struct mail_index *index)
More information about the dovecot-cvs
mailing list