Re: Bug #17959 [NEW]: Boundaries ending with non-word characters are ignored

From: Date: Thu, 28 Oct 2010 04:17:36 +0000
Subject: Re: Bug #17959 [NEW]: Boundaries ending with non-word characters are ignored
References: 1 2  Groups: php.pear.qa 
Request: Send a blank email to pear-qa+get-5791@lists.php.net to get a copy of this message
Alan, Sorry for the delayed response - just returned from vacation. On 10/20/2010 1:26 AM, Alan Knowles wrote: > Alex, the bug system is playing up, so I'm can't update a response. Yeah, for some reason it won't let me validate my email address/account, and consequently this bug has since been deleted. Unfortunately, I don't think I'm able to open a new bug report without this issue being fixed. > boundary split should split on the boundary string, followed by a line > break. - Can you > add a full email example where this problem occurs, either to this bug > report, or create a new one. I have attached a sample email, with some sensitive parts removed. I also created a simple patch that fixes the problem and attached it (I was going to attach it to the original bug report, but couldn't due to the problems mentioned above). Thanks, Alex

From: sender@example.com Subject: To: recipient@example.com Date: Fri, 1 Oct 2010 11:35:55 -0500 Message-Id: <20101001113555MN.DCSML-S002790000.0000748F8B85@172.31.1.80> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="DC_BOUND_PRE_<1285950955.0000748f8b85>" This is a multi-part message in MIME format. --DC_BOUND_PRE_<1285950955.0000748f8b85> Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit This E-mail was sent from "**********" (******). Scan Date: 01.10.2010 11:35:55 (-0500) Queries to: *******@**.com --DC_BOUND_PRE_<1285950955.0000748f8b85> Content-Type: application/pdf; name="20101001113555392.pdf" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="20101001113555392.pdf" [File contents removed] --DC_BOUND_PRE_<1285950955.0000748f8b85>-- --- Mail/mimeDecode.php.orig 2010-09-28 17:41:12.000000000 -0500 +++ Mail/mimeDecode.php 2010-10-08 17:57:41.000000000 -0500 @@ -658,7 +658,7 @@ $boundary = $bs_possible; } - $tmp = preg_split("/--".preg_quote($boundary, '/')."(\b|--)/", $input); + $tmp = preg_split("/--".preg_quote($boundary, '/')."((?=\s)|--)/", $input); $len = count($tmp) -1; for ($i = 1; $i < $len; $i++) { if (strlen(trim($tmp[$i]))) {
« previous php.pear.qa (#5791) next »