dovecot-2.2: dict file: Fixed corruption with large values.
dovecot at dovecot.org
dovecot at dovecot.org
Thu Aug 30 22:05:17 EEST 2012
details: http://hg.dovecot.org/dovecot-2.2/rev/6e53209030f6
changeset: 15002:6e53209030f6
user: Timo Sirainen <tss at iki.fi>
date: Tue Aug 28 18:53:30 2012 +0300
description:
dict file: Fixed corruption with large values.
Patch by Ewald Dieterich.
diffstat:
src/lib-dict/dict-file.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diffs (20 lines):
diff -r 7e7364926540 -r 6e53209030f6 src/lib-dict/dict-file.c
--- a/src/lib-dict/dict-file.c Tue Aug 28 15:57:22 2012 +0300
+++ b/src/lib-dict/dict-file.c Tue Aug 28 18:53:30 2012 +0300
@@ -186,9 +186,14 @@
if (dict->fd != -1) {
input = i_stream_create_fd(dict->fd, (size_t)-1, FALSE);
- while ((key = i_stream_read_next_line(input)) != NULL &&
- (value = i_stream_read_next_line(input)) != NULL) {
+
+ while ((key = i_stream_read_next_line(input)) != NULL) {
+ /* strdup() before the second read */
key = p_strdup(dict->hash_pool, key);
+
+ if ((value = i_stream_read_next_line(input)) == NULL)
+ break;
+
value = p_strdup(dict->hash_pool, value);
hash_table_insert(dict->hash, key, value);
}
More information about the dovecot-cvs
mailing list