From: Timo Sirainen Date: Wed, 13 Jun 2018 17:09:32 +0000 (+0300) Subject: doveadm dump: Fix dumping "vsize" header in dovecot.index X-Git-Tag: 2.3.9~1712 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d1d8792e51c141cdb596acdd3a8020fa86dc66df;p=thirdparty%2Fdovecot%2Fcore.git doveadm dump: Fix dumping "vsize" header in dovecot.index It was trying to print it as the "vsize" header in dovecot.list.index. This caused confusing output, as well as potentially accessing memory out of bounds. --- diff --git a/src/doveadm/doveadm-dump-index.c b/src/doveadm/doveadm-dump-index.c index 9abc535c79..1b38de2a4f 100644 --- a/src/doveadm/doveadm-dump-index.c +++ b/src/doveadm/doveadm-dump-index.c @@ -725,7 +725,10 @@ static void dump_record(struct mail_index_view *view, unsigned int seq) printf(" : unseen = %u\n", lrec->unseen); printf(" : recent = %u\n", lrec->recent); printf(" : uidnext = %u\n", lrec->uidnext); - } else if (strcmp(ext[i].name, "vsize") == 0) { + } else if (strcmp(ext[i].name, "vsize") == 0 && + ext[i].record_size >= sizeof(struct mailbox_index_vsize)) { + /* this is "vsize" in dovecot.list.index, not the + 32bit "vsize" in dovecot.index */ const struct mailbox_index_vsize *vrec = data; printf(" : vsize = %"PRIu64"\n", vrec->vsize); printf(" : highest_uid = %u\n", vrec->highest_uid);