dovecot-1.2: Charset conversion: Don't panic if iconv() doesn't ...

dovecot at dovecot.org dovecot at dovecot.org
Fri Mar 20 00:20:07 EET 2009


details:   http://hg.dovecot.org/dovecot-1.2/rev/96102e6cd333
changeset: 8842:96102e6cd333
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Mar 19 18:19:56 2009 -0400
description:
Charset conversion: Don't panic if iconv() doesn't produce valid UTF-8 output.

diffstat:

1 file changed, 4 insertions(+), 3 deletions(-)
src/lib-charset/charset-iconv.c |    7 ++++---

diffs (17 lines):

diff -r ea833e894759 -r 96102e6cd333 src/lib-charset/charset-iconv.c
--- a/src/lib-charset/charset-iconv.c	Thu Mar 19 17:06:33 2009 -0400
+++ b/src/lib-charset/charset-iconv.c	Thu Mar 19 18:19:56 2009 -0400
@@ -117,9 +117,10 @@ charset_to_utf8_try(struct charset_trans
 	} else {
 		size_t tmpsize = sizeof(tmpbuf) - destleft;
 
-		/* we just converted data to UTF-8, it can't be invalid */
-		if (uni_utf8_to_decomposed_titlecase(tmpbuf, tmpsize, dest) < 0)
-			i_unreached();
+		/* we just converted data to UTF-8. it shouldn't be invalid,
+		   but Solaris iconv appears to pass invalid data through
+		   sometimes (e.g. 8 bit characters with UTF-7) */
+		(void)uni_utf8_to_decomposed_titlecase(tmpbuf, tmpsize, dest);
 	}
 	return ret;
 }


More information about the dovecot-cvs mailing list