From: Aki Tuomi Date: Thu, 20 Aug 2020 06:53:11 +0000 (+0300) Subject: imap: imap-sync - Avoid unsigned integer overflow X-Git-Tag: 2.3.13~195 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4eb3f6f27;p=thirdparty%2Fdovecot%2Fcore.git imap: imap-sync - Avoid unsigned integer overflow Error: imap-sync.c:433:17: runtime error: unsigned integer overflow: 4294967295 + 1 cannot be represented in type 'unsigned int' --- diff --git a/src/imap/imap-sync.c b/src/imap/imap-sync.c index c777b941f9..ecbc83c35a 100644 --- a/src/imap/imap-sync.c +++ b/src/imap/imap-sync.c @@ -427,10 +427,10 @@ static void imap_sync_vanished(struct imap_sync_context *ctx) line = t_str_new(256); str_append(line, "* VANISHED "); for (i = 0; i < count; i++) { - start_uid = 0; prev_uid = (uint32_t)-1; + start_uid = 0; prev_uid = 0; for (seq = seqs[i].seq1; seq <= seqs[i].seq2; seq++) { mail_set_seq(ctx->mail, seq); - if (prev_uid + 1 != ctx->mail->uid) { + if (prev_uid != ctx->mail->uid - 1) { if (start_uid != 0) { if (!comma) comma = TRUE;