dovecot-2.0: dbox: Added a sanity check so that too small dbox f...

dovecot at dovecot.org dovecot at dovecot.org
Mon Jul 12 22:38:50 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/0a2dc81ed513
changeset: 11805:0a2dc81ed513
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Jul 12 20:38:47 2010 +0100
description:
dbox: Added a sanity check so that too small dbox files won't be appended to.

diffstat:

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

diffs (15 lines):

diff -r 5e285530914c -r 0a2dc81ed513 src/lib-storage/index/dbox-common/dbox-file.c
--- a/src/lib-storage/index/dbox-common/dbox-file.c	Mon Jul 12 16:27:51 2010 +0100
+++ b/src/lib-storage/index/dbox-common/dbox-file.c	Mon Jul 12 20:38:47 2010 +0100
@@ -573,6 +573,11 @@
 			dbox_file_set_syscall_error(file, "fstat()");
 			return -1;
 		}
+		if (st.st_size < file->msg_header_size) {
+			dbox_file_set_corrupted(file,
+				"dbox file size too small");
+			return 0;
+		}
 		o_stream_seek(ctx->output, st.st_size);
 	}
 	*output_r = ctx->output;


More information about the dovecot-cvs mailing list