dovecot-2.2: lib-imap: Make sure imap_utf7_to_utf8() doesn't acc...

dovecot at dovecot.org dovecot at dovecot.org
Wed Jun 5 17:50:10 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/b3c6f97ad3ac
changeset: 16456:b3c6f97ad3ac
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Jun 05 17:49:46 2013 +0300
description:
lib-imap: Make sure imap_utf7_to_utf8() doesn't access invalid input string out of bounds.

diffstat:

 src/lib-imap/imap-utf7.c |  4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diffs (15 lines):

diff -r a38a7b5fb195 -r b3c6f97ad3ac src/lib-imap/imap-utf7.c
--- a/src/lib-imap/imap-utf7.c	Wed Jun 05 17:48:48 2013 +0300
+++ b/src/lib-imap/imap-utf7.c	Wed Jun 05 17:49:46 2013 +0300
@@ -179,8 +179,10 @@
 
 	while (*src != '-') {
 		input[0] = imap_b64dec[(uint8_t)src[0]];
+		if (input[0] == 0xff)
+			return -1;
 		input[1] = imap_b64dec[(uint8_t)src[1]];
-		if (input[0] == 0xff || input[1] == 0xff)
+		if (input[1] == 0xff)
 			return -1;
 
 		output[outpos % 4] = (input[0] << 2) | (input[1] >> 4);


More information about the dovecot-cvs mailing list