dovecot-2.2: Avoid unsigned integer overflows.

dovecot at dovecot.org dovecot at dovecot.org
Sun Feb 24 15:00:20 EET 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/94ebc333c47a
changeset: 15912:94ebc333c47a
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Feb 24 15:00:13 2013 +0200
description:
Avoid unsigned integer overflows.

diffstat:

 src/imap/imap-commands-util.c   |  4 +++-
 src/lib-index/mail-index-util.c |  2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r b0682d64a990 -r 94ebc333c47a src/imap/imap-commands-util.c
--- a/src/imap/imap-commands-util.c	Sun Feb 24 14:59:54 2013 +0200
+++ b/src/imap/imap-commands-util.c	Sun Feb 24 15:00:13 2013 +0200
@@ -326,7 +326,9 @@
 
 void msgset_generator_next(struct msgset_generator_context *ctx, uint32_t uid)
 {
-	if (uid != ctx->last_uid+1) {
+	i_assert(uid > 0);
+
+	if (uid-1 != ctx->last_uid) {
 		if (ctx->first_uid == 0)
 			;
 		else if (ctx->first_uid == ctx->last_uid)
diff -r b0682d64a990 -r 94ebc333c47a src/lib-index/mail-index-util.c
--- a/src/lib-index/mail-index-util.c	Sun Feb 24 14:59:54 2013 +0200
+++ b/src/lib-index/mail-index-util.c	Sun Feb 24 15:00:13 2013 +0200
@@ -106,7 +106,7 @@
 static int mail_index_seq_record_cmp(const uint32_t *key_seq,
 				     const uint32_t *data_seq)
 {
-	return *key_seq - *data_seq;
+	return (int)*key_seq - (int)*data_seq;
 }
 
 bool mail_index_seq_array_lookup(const ARRAY_TYPE(seq_array) *array,


More information about the dovecot-cvs mailing list