dovecot-2.0: imap: Don't crash with QRESYNC SELECT specifying se...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Aug 19 20:36:15 EEST 2010
details: http://hg.dovecot.org/dovecot-2.0/rev/83c0e7687e5e
changeset: 12013:83c0e7687e5e
user: Timo Sirainen <tss at iki.fi>
date: Thu Aug 19 18:36:09 2010 +0100
description:
imap: Don't crash with QRESYNC SELECT specifying sequences larger than mailbox's message count.
diffstat:
src/imap/imap-fetch.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diffs (23 lines):
diff -r eed1426f55a9 -r 83c0e7687e5e src/imap/imap-fetch.c
--- a/src/imap/imap-fetch.c Thu Aug 19 18:28:20 2010 +0100
+++ b/src/imap/imap-fetch.c Thu Aug 19 18:36:09 2010 +0100
@@ -150,6 +150,7 @@
expunges_drop_known(struct imap_fetch_context *ctx, struct mail *mail,
ARRAY_TYPE(seq_range) *expunged_uids)
{
+ struct mailbox_status status;
const uint32_t *seqs, *uids;
unsigned int i, count;
@@ -158,8 +159,10 @@
i_assert(array_count(ctx->qresync_sample_uidset) == count);
i_assert(count > 0);
+ mailbox_get_status(ctx->box, STATUS_MESSAGES, &status);
+
/* FIXME: we could do removals from the middle as well */
- for (i = 0; i < count; i++) {
+ for (i = 0; i < count && seqs[i] <= status.messages; i++) {
mail_set_seq(mail, seqs[i]);
if (uids[i] != mail->uid)
break;
More information about the dovecot-cvs
mailing list