From: Timo Sirainen Date: Thu, 19 Mar 2009 22:19:56 +0000 (-0400) Subject: Charset conversion: Don't panic if iconv() doesn't produce valid UTF-8 output. X-Git-Tag: 1.2.beta4~22 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=642de38d5d41db0e7f5e365bbf5e42dc01323620;p=thirdparty%2Fdovecot%2Fcore.git Charset conversion: Don't panic if iconv() doesn't produce valid UTF-8 output. --HG-- branch : HEAD --- diff --git a/src/lib-charset/charset-iconv.c b/src/lib-charset/charset-iconv.c index 9d3b8af89d..a7ca45623a 100644 --- a/src/lib-charset/charset-iconv.c +++ b/src/lib-charset/charset-iconv.c @@ -117,9 +117,10 @@ charset_to_utf8_try(struct charset_translation *t, } 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; }