]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dbox: Added a sanity check so that too small dbox files won't be appended to.
authorTimo Sirainen <tss@iki.fi>
Mon, 12 Jul 2010 19:38:47 +0000 (20:38 +0100)
committerTimo Sirainen <tss@iki.fi>
Mon, 12 Jul 2010 19:38:47 +0000 (20:38 +0100)
src/lib-storage/index/dbox-common/dbox-file.c

index b56aa50b8312ab7cd97c839bf84c67e8124c2ce7..58fa3a9e4d173ef15fe46611b17d856fde44a466 100644 (file)
@@ -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;