[Bug+Patch] error in IMAP mailbox encoding



Hi all,

Balsa has a bug in encoding IMAP mailbox names to modified UTF-7 as defined in RFC 3501, sect. 5.1.3 [1], as 
the '\' (0x5c) is encoded as '\\' which is explicitly prohibited.  To reproduce: activate main() in 
libbalsa/imap/util.c, compile it, and run e.g. (yes, the mailbox name is weird, but it includes all special 
cases from the RFC…)

./util 'ϴä ab c&d+e/f\~ßx'
orig='ϴä ab c&d+e/f\~ßx' mbx='&A,QA5A- ab c&-d+e/f\\~&AN8-x' back='ϴä ab c&d+e/f\\~ßx'
WRONG CONVERSION: --------------------------------^^

The attached patch replaces the hand-coded conversion by utilising g_convert(), and also fixes the bug.  For 
testing:

./util 'ϴä ab c&d+e/f\~ßx'
orig='ϴä ab c&d+e/f\~ßx' mbx='&A,QA5A- ab c&-d+e/f\~&AN8-x' back='ϴä ab c&d+e/f\~ßx'
PROPER CONVERSION: -----------------------------^

Opinions?

Cheers,
Albrecht.

[1] <https://tools.ietf.org/html/rfc3501#section-5.1.3>

Attachment: fix-imap-utf7-encoding.diff
Description: Text Data

Attachment: pgpGgY_69_tcD.pgp
Description: PGP signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]