dovecot-2.2: Make sure we don't shift signed integers left by 24...

dovecot at dovecot.org dovecot at dovecot.org
Fri Jun 13 08:37:03 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/5416df86b603
changeset: 17487:5416df86b603
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Jun 13 11:35:40 2014 +0300
description:
Make sure we don't shift signed integers left by 24. They should be unsigned.

diffstat:

 src/lib-index/mailbox-log.c |  2 +-
 src/lib/hmac-cram-md5.c     |  2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diffs (24 lines):

diff -r 892aee3e5a05 -r 5416df86b603 src/lib-index/mailbox-log.c
--- a/src/lib-index/mailbox-log.c	Fri Jun 13 11:21:07 2014 +0300
+++ b/src/lib-index/mailbox-log.c	Fri Jun 13 11:35:40 2014 +0300
@@ -154,7 +154,7 @@
 
 time_t mailbox_log_record_get_timestamp(const struct mailbox_log_record *rec)
 {
-	return ((time_t)rec->timestamp[0] << 24) |
+	return (time_t)(rec->timestamp[0] << 24) |
 		((time_t)rec->timestamp[1] << 16) |
 		((time_t)rec->timestamp[2] << 8) |
 		(time_t)rec->timestamp[3];
diff -r 892aee3e5a05 -r 5416df86b603 src/lib/hmac-cram-md5.c
--- a/src/lib/hmac-cram-md5.c	Fri Jun 13 11:21:07 2014 +0300
+++ b/src/lib/hmac-cram-md5.c	Fri Jun 13 11:35:40 2014 +0300
@@ -48,7 +48,7 @@
 	(c)  = (*p++);           \
 	(c) += (*p++ << 8);      \
 	(c) += (*p++ << 16);     \
-	(c) += (*p++ << 24);     \
+	(c) += ((uint32_t)(*p++) << 24);     \
 } STMT_END
 	cdp = context_digest;
 	CDGET(cdp, ctxo->a);


More information about the dovecot-cvs mailing list