]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Charset conversion: Don't panic if iconv() doesn't produce valid UTF-8 output.
authorTimo Sirainen <tss@iki.fi>
Thu, 19 Mar 2009 22:19:56 +0000 (18:19 -0400)
committerTimo Sirainen <tss@iki.fi>
Thu, 19 Mar 2009 22:19:56 +0000 (18:19 -0400)
--HG--
branch : HEAD

src/lib-charset/charset-iconv.c

index 9d3b8af89d998127a9314cb8ad3e65187b5302ec..a7ca45623a467c75a4e883cecf5ad2d651fed9e1 100644 (file)
@@ -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;
 }