dovecot-1.1: mail_index_update_header_ext(): Don't crash if size...
dovecot at dovecot.org
dovecot at dovecot.org
Wed Jun 18 06:33:31 EEST 2008
details: http://hg.dovecot.org/dovecot-1.1/rev/b1bdabe80a33
changeset: 7682:b1bdabe80a33
user: Timo Sirainen <tss at iki.fi>
date: Wed Jun 18 06:33:08 2008 +0300
description:
mail_index_update_header_ext(): Don't crash if size isn't 32bit aligned.
diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
src/lib-index/mail-transaction-log-append.c | 4 +++-
diffs (19 lines):
diff -r 0d9c3270172b -r b1bdabe80a33 src/lib-index/mail-transaction-log-append.c
--- a/src/lib-index/mail-transaction-log-append.c Wed Jun 18 06:28:18 2008 +0300
+++ b/src/lib-index/mail-transaction-log-append.c Wed Jun 18 06:33:08 2008 +0300
@@ -290,12 +290,14 @@ log_append_ext_hdr_update(struct log_app
buffer_t *buf;
unsigned int hdr_size;
- hdr_size = sizeof(*trans_hdr) + hdr->size;
+ hdr_size = sizeof(*trans_hdr) + hdr->size + 4;
buf = buffer_create_static_hard(pool_datastack_create(), hdr_size);
trans_hdr = buffer_append_space_unsafe(buf, sizeof(*trans_hdr));
trans_hdr->offset = hdr->offset;
trans_hdr->size = hdr->size;
buffer_append(buf, hdr + 1, hdr->size);
+ if (buf->used % 4 != 0)
+ buffer_append_zero(buf, 4 - buf->used % 4);
log_append_buffer(ctx, buf, NULL, MAIL_TRANSACTION_EXT_HDR_UPDATE);
}
More information about the dovecot-cvs
mailing list