Skip to content

Commit

Permalink
doveadm dump: Fix dumping "vsize" header in dovecot.index
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sirainen committed Aug 22, 2018
1 parent 7903167 commit be4e0a5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/doveadm/doveadm-dump-index.c
Expand Up @@ -715,7 +715,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);
Expand Down

0 comments on commit be4e0a5

Please sign in to comment.