From: Timo Sirainen Date: Mon, 12 Jul 2010 19:38:47 +0000 (+0100) Subject: dbox: Added a sanity check so that too small dbox files won't be appended to. X-Git-Tag: 2.0.rc3~71 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=befc6b57b5ae976c8f8e05abe828b141129d4415;p=thirdparty%2Fdovecot%2Fcore.git dbox: Added a sanity check so that too small dbox files won't be appended to. --- diff --git a/src/lib-storage/index/dbox-common/dbox-file.c b/src/lib-storage/index/dbox-common/dbox-file.c index b56aa50b83..58fa3a9e4d 100644 --- a/src/lib-storage/index/dbox-common/dbox-file.c +++ b/src/lib-storage/index/dbox-common/dbox-file.c @@ -573,6 +573,11 @@ int dbox_file_get_append_stream(struct dbox_file_append_context *ctx, 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;