dovecot-2.2: lib-imap: imap-utf7 - only encode in-range 7-bit va...

dovecot at dovecot.org dovecot at dovecot.org
Mon Jul 28 13:54:32 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/65c61f2d0e75
changeset: 17662:65c61f2d0e75
user:      Phil Carmody <phil at dovecot.fi>
date:      Mon Jul 28 16:49:47 2014 +0300
description:
lib-imap: imap-utf7 - only encode in-range 7-bit values
0x01-0x1F and 0x7f-... must be mBASE64 encoded.

Signed-off-by: Phil Carmody <phil at dovecot.fi>

diffstat:

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

diffs (29 lines):

diff -r 0c0559782618 -r 65c61f2d0e75 src/lib-imap/imap-utf7.c
--- a/src/lib-imap/imap-utf7.c	Mon Jul 28 16:49:47 2014 +0300
+++ b/src/lib-imap/imap-utf7.c	Mon Jul 28 16:49:47 2014 +0300
@@ -60,7 +60,7 @@
 	const char *p;
 
 	for (p = str; *p != '\0'; p++) {
-		if (*p == '&' || (unsigned char)*p >= 0x80)
+		if (*p == '&' || *p < 0x20 || *p >= 0x7f)
 			return p;
 	}
 	return NULL;
@@ -89,14 +89,14 @@
 			p++;
 			continue;
 		}
-		if ((unsigned char)*p < 0x80) {
+		if (*p >= 0x20 && *p < 0x7f) {
 			str_append_c(dest, *p);
 			p++;
 			continue;
 		}
 
 		u = utf16;
-		while ((unsigned char)*p >= 0x80) {
+		while (*p != '\0' && (*p < 0x20 || *p >= 0x7f)) {
 			if (uni_utf8_get_char(p, &chr) <= 0)
 				return -1;
 			/* @UNSAFE */


More information about the dovecot-cvs mailing list