Permalink
Browse files

mailparse: Fix incorrect parsing of some multipart messages

This patch drops the content after the last boundary in a multi-part message
which prevents it from being considered in some case where the available
content sections are not favorable.

Backport me to v1.9
  • Loading branch information...
greezybacon committed Aug 17, 2015
1 parent eca531f commit fe62226669a48aa4e9e0872266eb6395a38562e6
Showing with 9 additions and 0 deletions.
  1. +9 −0 include/pear/Mail/mimeDecode.php
@@ -529,6 +529,15 @@ function _boundarySplit($input, $boundary)
if ($input instanceof StringView) {
$parts = $input->split('--' . $boundary);
array_shift($parts);
if (count($parts) > 0
&& $parts[count($parts)-1]->substr(0, 2)->__toString() == '--'
) {
// Drop the last part if it starts with '--' as such would
// be past the end of a multipart section
array_pop($parts);
}
return $parts;
}

0 comments on commit fe62226

Please sign in to comment.