Description of problem: If the email's To: header has a colon after display name, etpan crashes in library's src/low-level/imf/mailimf.c line 3049 free_mailbox_list: mailimf_mailbox_list_free(mailbox_list); For example: A mail having To: Michael: will cause the mailbox_list to be null and upon reaching this list free function, it will segfault and crash. Version-Release number of selected component (if applicable): libetpan-0.52-1 How reproducible: Steps to Reproduce: 1. Please take a standard e-mail and insert a : in front of the displayname in the To e-mail address. (This happens due to bad e-mail server sending such e-mails). 2. Parse that e-mail with etpan. 3. Notice the segfault. Actual results: etpan crashes. Expected results: etpan should return error. Additional info: A fix is to check for null of mailbox_list before calling mailimf_mailbox_list_free on it. Please provide this fix ASAP.
Vinay, how did you come across this problem? Only application in Fedora using libetpan seems to be the claws-mail, but I fail to reproduce the problem with it. Why did you flagged this as security issue?
Seems like he is using the etpan mail client provided from the etpan folks. Could you provide some more info regarding this?
Yes, I've written an application that receives e-mail from a mail gateway and parses it using etpan library. When a mail with a colon in the To address comes in, the parser crashes. Let me know if you need a standalone code to repro this issue.
Created attachment 309375 [details] The test message that causes the crash in mime parser. This mime message has an extra colon in the To header after the display name. The parser doesn't handle this case. It goes into a bad state and tries to free up a unallocated structure, causing it to seg-fault.
Created attachment 309376 [details] A simple test code that reproduces the crash. This is a very simple test code that calls mailmime_parse on the test message to reproduce the crash.
Created attachment 309377 [details] A patch that fixes the crash This patch changes libetpan-0.52/src/low-level/imf/mailimf.c mailimf_group_parse function to checks the mailbox_list pointer before calling mailimf_mailbox_list_free on it.
Please accept the above patch and release a fixed rpm for Fedora. Although the above patch fixes this crash, ideally the parser should be able to ignore the extra : after displayname and continue parsing. This maybe a more complex fix.
This issue has been fixed with the same null check in the upstream cvs repository. http://libetpan.cvs.sourceforge.net/libetpan/libetpan/src/low-level/imf/mailimf.c?view=diff&r1=1.46&r2=1.47
Un-restricting bug, as the patch is public in upstream CVS.
libetpan-0.54-1.fc8 has been submitted as an update for Fedora 8
libetpan-0.54-1.fc9 has been submitted as an update for Fedora 9
libetpan-0.54-1.fc9 has been pushed to the Fedora 9 testing repository. If problems still persist, please make note of it in this bug report. If you want to test the update, you can install it with su -c 'yum --enablerepo=updates-testing update libetpan'. You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F9/FEDORA-2008-5469
libetpan-0.54-1.fc9 has been pushed to the Fedora 9 stable repository. If problems still persist, please make note of it in this bug report.
libetpan-0.54-1.fc8 has been pushed to the Fedora 8 stable repository. If problems still persist, please make note of it in this bug report.