Opened 9 years ago

Closed 8 years ago

#11598 closed patch (fixed)

purple_mime_document_parsen() broken when '=' char included in boundary

Reported by: haakon Owned by:
Milestone: 2.7.8 Component: libpurple
Version: Keywords: mime libpurple
Cc:

Description

libpurple's purple_mime_document_parsen() in mime.c behaves incorrectly when MIME multipart message contains '=' in the boundary.

For example I found that MS Office Communicator 2007 R2 sends messages like

Content-Type: multipart/alternative;boundary="----=_NextPart_000_009D_01CACDCB.F5BB04D0"

With current implementation, boundary gets parsed like

_NextPart_000_009D_01CACDCB.F5BB04D0"

so no message parts are found afterwards.

I believe attached patch fixes this issue.

Attachments (1)

purple_mime_document_parsen.patch (1.1 KB) - added by haakon 9 years ago.
Updated version of the patch

Download all attachments as: .zip

Change History (5)

comment:1 Changed 9 years ago by darkrain42

  • Milestone set to Patches Needing Review

comment:2 follow-up: Changed 9 years ago by QuLogic

Is there a reason to search the string backwards? Since we're fixing '='-in-boundary, what would happen if the delimiter were boundary="==boundary=="?

Also, you can use g_strndup instead of alloc+copy. And this isn't C++, so you can't define char *bnd in the middle of the function.

Changed 9 years ago by haakon

Updated version of the patch

comment:3 in reply to: ↑ 2 Changed 9 years ago by haakon

Replying to QuLogic:

Is there a reason to search the string backwards? Since we're fixing '='-in-boundary, what would happen if the delimiter were boundary="==boundary=="?

That's true, string must be searched from the beginning.

And this isn't C++, so you can't define char *bnd in the middle of the function.

Sorry, my fault.

Attached updated version of the patch.

comment:4 Changed 8 years ago by jakub.adam@…

  • Milestone changed from Patches Needing Review to 2.7.8
  • Resolution set to fixed
  • Status changed from new to closed

(In 3a43fb06bb25d5b2835f6a1f60e9543396b4c457):
Correct parsing of multipart messages in purple_mim_document_parse, when the boundary contains a '='.

Fixes #11598.

Note: See TracTickets for help on using tickets.
All information, including names and email addresses, entered onto this website or sent to mailing lists affiliated with this website will be public. Do not post confidential information, especially passwords!