2 May
2017
2 May
'17
10:21 a.m.
Hi all, at work we use Roundcube acting as a mail client for the Dovecot Imap server.
In Roundube the messages are parsed through the Imap BODYSTRUCTURE command If a message contains forwarded messages and attachments and some of the messages contains a quote (") in the subject, then the resulting BODYSTRUCTURE appears to be malformed.
After some digging through the code of Dovecot, it seems to me that the problem is related to the function: imap_append_string_for_humans defined at the line 120 of the file src/lib-imap/imap-quote.c (dovecot sources v. 2.2.29)
Said function is supposed to return a quoted version of the input string while removing unwanted characters from the input data.
But, if I call it with a string containing quotes as argument (eg: I am a lazy " programmer) in the resulting output the quotes aren't escaped and the output string is not quoted.
This is related to the stated issue through the function calls in: part_write_body [ defined at line 142 of imap-bodystructure.c ] which calls imap_envelope_write [defined at line 46 of imap-envelope.c] which finally calls imap_append_string_for_humans
Thank you for your time.
Best regards, Giovanni S. Fois