changeset 11805:0a2dc81ed513

dbox: Added a sanity check so that too small dbox files won't be appended to.
author Timo Sirainen <tss@iki.fi>
date Mon, 12 Jul 2010 20:38:47 +0100
parents 5e285530914c
children 9ccfbed9c570
files src/lib-storage/index/dbox-common/dbox-file.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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;