PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Mail » Mail_mimeDecode » Bug #9100

Error with nested boundaries where inner boundary is a subset of the outer

Details

Submitted2006-10-20 04:31 UTC
Fromrocca at start dot ca
Assignedalan_k
StatusClosed
PackageMail_mimeDecode
PHP VersionIrrelevant
OSAll
Roadmaps1.6.0

Comments

[2006-10-20 04:31 UTC] rocca at start dot ca

Description:
------------
If the input data has an inner boundary that contains a subset of the outer boundary the _boundarySplit function will incorrectly parse the data.

For example:

Content-Type: multipart/mixed; boundary="abc"

--abc
Content-Type: multipart/mixed; boundary="abc_a"

--abc_a
inner

--abc_a--
outer

--abc--

...will return 'abc_a' as being at the same level as 'abc' and additionally create some garbage nodes.

Test script:
---------------
function _boundarySplit($input, $boundary) {

- $tmp = explode('--' . $boundary, $input);
+ $tmp = preg_split("/--$boundary(\b|--)/", $input);

[2006-11-07 14:50 UTC] rocca at start dot ca

Changing PHP/OS version to Irrelevant. Also the 'test script' is actually the diff required to fix the problem. Ie, using preg_split instead of explode.