dovecot-2.1: mdbox: Avoid deferencing NULL pointer in specific c...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Feb 9 02:24:17 EET 2012
details: http://hg.dovecot.org/dovecot-2.1/rev/69bb267956a2
changeset: 14085:69bb267956a2
user: Timo Sirainen <tss at iki.fi>
date: Thu Feb 09 02:21:37 2012 +0200
description:
mdbox: Avoid deferencing NULL pointer in specific corrupted mailboxes.
diffstat:
src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diffs (28 lines):
diff -r d8d214cc1936 -r 69bb267956a2 src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c
--- a/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c Thu Feb 09 01:23:00 2012 +0200
+++ b/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c Thu Feb 09 02:21:37 2012 +0200
@@ -356,7 +356,6 @@
struct mail_index_view *view,
struct mail_index_transaction *trans)
{
- const struct mdbox_mail_index_record *dbox_rec;
struct mdbox_mail_index_record new_dbox_rec;
const struct mail_index_header *hdr;
struct mdbox_rebuild_msg *rec;
@@ -368,9 +367,13 @@
for (seq = 1; seq <= hdr->messages_count; seq++) {
mail_index_lookup_ext(view, seq, mbox->ext_id,
&data, &expunged);
- dbox_rec = data;
- new_dbox_rec = *dbox_rec;
- map_uid = dbox_rec == NULL ? 0 : dbox_rec->map_uid;
+ if (data == NULL) {
+ memset(&new_dbox_rec, 0, sizeof(new_dbox_rec));
+ map_uid = 0;
+ } else {
+ memcpy(&new_dbox_rec, data, sizeof(new_dbox_rec));
+ map_uid = new_dbox_rec.map_uid;
+ }
mail_index_lookup_ext(view, seq, mbox->guid_ext_id,
&data, &expunged);
More information about the dovecot-cvs
mailing list