Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 451025 - crash in mailimf_group_parse due to a colon in To: address
Summary: crash in mailimf_group_parse due to a colon in To: address
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: libetpan
Version: 8
Hardware: All
OS: Linux
low
urgent
Target Milestone: ---
Assignee: Andreas Bierfert
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-06-12 14:03 UTC by Vinay Y S
Modified: 2008-07-26 06:07 UTC (History)
1 user (show)

Fixed In Version: 0.54-1.fc9
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-06-26 08:31:52 UTC


Attachments (Terms of Use)
The test message that causes the crash in mime parser. (deleted)
2008-06-14 22:45 UTC, Vinay Y S
no flags Details
A simple test code that reproduces the crash. (deleted)
2008-06-14 22:46 UTC, Vinay Y S
no flags Details
A patch that fixes the crash (deleted)
2008-06-14 22:59 UTC, Vinay Y S
no flags Details | Diff

Description Vinay Y S 2008-06-12 14:03:52 UTC
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.

Comment 1 Tomas Hoger 2008-06-12 20:07:47 UTC
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?

Comment 2 Andreas Bierfert 2008-06-13 14:15:25 UTC
Seems like he is using the etpan mail client provided from the etpan folks.
Could you provide some more info regarding this?

Comment 3 Vinay Y S 2008-06-14 13:02:51 UTC
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.

Comment 4 Vinay Y S 2008-06-14 22:45:20 UTC
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.

Comment 5 Vinay Y S 2008-06-14 22:46:43 UTC
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.

Comment 6 Vinay Y S 2008-06-14 22:59:14 UTC
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.

Comment 7 Vinay Y S 2008-06-14 23:01:46 UTC
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.

Comment 8 Vinay Y S 2008-06-15 18:09:28 UTC
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



Comment 9 Tomas Hoger 2008-06-16 14:16:14 UTC
Un-restricting bug, as the patch is public in upstream CVS.

Comment 10 Fedora Update System 2008-06-17 15:18:23 UTC
libetpan-0.54-1.fc8 has been submitted as an update for Fedora 8

Comment 11 Fedora Update System 2008-06-17 15:20:22 UTC
libetpan-0.54-1.fc9 has been submitted as an update for Fedora 9

Comment 12 Fedora Update System 2008-06-20 19:06:28 UTC
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

Comment 13 Fedora Update System 2008-06-26 08:31:50 UTC
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.

Comment 14 Fedora Update System 2008-06-26 08:34:45 UTC
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.

Comment 15 Fedora Update System 2008-07-26 06:07:13 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.