dovecot-2.2: dbox: Fixed potential infinite looping when scannin...

dovecot at dovecot.org dovecot at dovecot.org
Fri Jun 13 08:22:23 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/892aee3e5a05
changeset: 17486:892aee3e5a05
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Jun 13 11:21:07 2014 +0300
description:
dbox: Fixed potential infinite looping when scanning a broken dbox file.

diffstat:

 src/lib-storage/index/dbox-common/dbox-file-fix.c |  4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diffs (21 lines):

diff -r 87da927c3c19 -r 892aee3e5a05 src/lib-storage/index/dbox-common/dbox-file-fix.c
--- a/src/lib-storage/index/dbox-common/dbox-file-fix.c	Fri Jun 13 10:25:22 2014 +0300
+++ b/src/lib-storage/index/dbox-common/dbox-file-fix.c	Fri Jun 13 11:21:07 2014 +0300
@@ -20,14 +20,16 @@
 	const unsigned char *data;
 	size_t size;
 	uoff_t offset = input->v_offset;
+	bool have_lf = FALSE;
 
 	data = i_stream_get_data(input, &size);
 	if (data[0] == '\n') {
 		data++; size--; offset++;
+		have_lf = TRUE;
 	}
 	i_assert(data[0] == DBOX_MAGIC_PRE[0]);
 	if (size < sizeof(*hdr)) {
-		*need_bytes = sizeof(*hdr);
+		*need_bytes = sizeof(*hdr) + (have_lf ? 1 : 0);
 		return -1;
 	}
 	hdr = (const void *)data;


More information about the dovecot-cvs mailing list