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

dovecot at dovecot.org dovecot at dovecot.org
Fri Jun 13 08:46:38 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.1/rev/74037ec725d3
changeset: 15020:74037ec725d3
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 d50ac1b3330d -r 74037ec725d3 src/lib-storage/index/dbox-common/dbox-file-fix.c
--- a/src/lib-storage/index/dbox-common/dbox-file-fix.c	Thu Jun 12 23:51:28 2014 +0300
+++ b/src/lib-storage/index/dbox-common/dbox-file-fix.c	Fri Jun 13 11:21:07 2014 +0300
@@ -21,14 +21,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