OK. I inserted a debug printf(). static int doconvtoutf8_rfc822hdr(const char *header, const char *value, struct rfc2045_decodemsgtoutf8_cb *callback) { struct doconvtoutf8_info info;
info.err_flag=0; info.callback=callback; if (callback->headerfilter_func && (*callback->headerfilter_func)(header, value, callback->arg) == 0) return 0; if ((callback->flags & RFC2045_DECODEMSG_NOHEADERNAME) == 0) { doconvtoutf8_write(header, strlen(header), &info); doconvtoutf8_write(\": \", 2, &info); } /***** Unexpected byte causes troubles. *****/ fprintf(stderr, \"doconvtoutf8_rfc822hdr: header=\'%s\' value=\'%s\'\\n\", header, value); /***** Unexpected byte causes troubles. *****/ rfc822_display_hdrvalue(header, value, \"utf-8\", doconvtoutf8_write, doconvtoutf8_error, &info); doconvtoutf8_write(\"\\n\", 1, &info); if (callback->headerdone_func && info.err_flag == 0) { int rc=(*callback->headerdone_func)(header, callback->arg); if (rc) info.err_flag=rc; } return info.err_flag; } Now, the output looks like below. It seems to me that calling rfc822_display_hdrvalue() with imcomplete value results in imcomplete conversion of string. INFO: LOGIN, user=demo, ip=[127.0.0.1], port=[0], protocol=IMAP * FLAGS (\\Draft \\Answered \\Flagged \\Deleted \\Seen \\Recent) * OK [PERMANENTFLAGS (\\Draft \\Answered \\Flagged \\Deleted \\Seen)] Limited * 1 EXISTS * 0 RECENT * OK [UIDVALIDITY 361408175] Ok * OK [MYRIGHTS \"acdilrsw\"] ACL 1 OK [READ-WRITE] Ok doconvtoutf8_rfc822hdr: header=\'Return-Path\' value=\'<r...@example.com>\' doconvtoutf8_rfc822hdr: header=\'Delivered-To\' value=\'r...@example.com\' doconvtoutf8_rfc822hdr: header=\'Message-Id\' value=\'<00000...@example.com>\' doconvtoutf8_rfc822hdr: header=\'From\' value=\'r...@example.com\' doconvtoutf8_rfc822hdr: header=\'To\' value=\'root <r...@example.com・, root <r...@example.com・, root <r...@example.com・, root <r...@example.com・, root <r...@example.com・, root <r...@example.com・, root <r...@example.com・, root <r...@example.com・, root <r...@example.com・, root <r...@example.com・, root <r...@example.com・, root <r...@example.com・, root <r...@example.com・, root <r...@example.com・, root <r...@example.com・, root <r...@example.com・, root <r...@example.com・, root <r...@example.com・, root <r...@example.com・, root <r...@example.com・, root <r...@example.com・, root <r...@example.com・\' ==26176== Invalid read of size 1 ==26176== at 0x40366C1: stringprep_utf8_to_ucs4 (nfkc.c:337) ==26176== by 0x4038B89: idna_to_unicode_8z4z (idna.c:702) ==26176== by 0x4038BF6: idna_to_unicode_8z8z (idna.c:732) ==26176== by 0x8082E29: rfc822_display_addr_str (rfc2047u.c:332) ==26176== by 0x808302A: rfc822_display_addr (rfc2047u.c:386) ==26176== by 0x808341B: rfc2047_print_unicodeaddr (rfc2047u.c:510) ==26176== by 0x808368A: rfc822_display_hdrvalue (rfc2047u.c:561) ==26176== by 0x806EDFE: rfc2045_decodemsgtoutf8 (rfc2045decodemsgtoutf8.c:60) ==26176== by 0x805FE96: search_oneatatime (search.c:691) ==26176== by 0x80601BC: search_internal (search.c:128) ==26176== by 0x80602F6: dosearch (search.c:76) ==26176== by 0x8057AD5: do_imap_command (imapd.c:5657) ==26176== Address 0x42a67bb is 1 bytes after a block of size 18 alloc\'d ==26176== at 0x402682F: malloc (vg_replace_malloc.c:236) ==26176== by 0x80853AB: rfc822_gettok (rfc822_getaddr.c:39) ==26176== by 0x8083007: rfc822_display_addr (rfc2047u.c:381) ==26176== by 0x808341B: rfc2047_print_unicodeaddr (rfc2047u.c:510) ==26176== by 0x808368A: rfc822_display_hdrvalue (rfc2047u.c:561) ==26176== by 0x806EDFE: rfc2045_decodemsgtoutf8 (rfc2045decodemsgtoutf8.c:60) ==26176== by 0x805FE96: search_oneatatime (search.c:691) ==26176== by 0x80601BC: search_internal (search.c:128) ==26176== by 0x80602F6: dosearch (search.c:76) ==26176== by 0x8057AD5: do_imap_command (imapd.c:5657) ==26176== by 0x80620CE: mainloop (mainloop.c:127) ==26176== by 0x8052BE1: main (imapd.c:6540) ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb _______________________________________________ Courier-imap mailing list Courier-imap@lists.sourceforge.net Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-imap