From 762f0f5c8aebffa56b67316ba3783f119a1a4214 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 19 Nov 2013 13:18:30 +0000 Subject: [PATCH] fixed infinit recursion in multipart message containing other multipart --- mail/inc/class.mail_bo.inc.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/mail/inc/class.mail_bo.inc.php b/mail/inc/class.mail_bo.inc.php index 625b7367dc..08d1240abe 100644 --- a/mail/inc/class.mail_bo.inc.php +++ b/mail/inc/class.mail_bo.inc.php @@ -3221,12 +3221,17 @@ class mail_bo $partText = $partHTML = null; if (self::$debug) _debug_array(array("METHOD"=>__METHOD__,"LINE"=>__LINE__,"STRUCTURE"=>$_structure)); + $ignore_first_part = true; foreach($_structure->contentTypeMap() as $mime_id => $mime_type) { //error_log(__METHOD__."($_uid, ".$_structure->getMimeId().") $mime_id: $mime_type"); if (self::$debug) echo __METHOD__."($_uid, partID=".$_structure->getMimeId().") $mime_id: $mime_type
"; - if (!$mime_id) continue; // ignore multipart/alternative itself + if ($ignore_first_part) + { + $ignore_first_part = false; + continue; // ignore multipart/alternative itself + } $mimePart = $_structure->getPart($mime_id); @@ -3340,12 +3345,17 @@ class mail_bo $bodyPart = array(); if (self::$debug) _debug_array($_structure); + $ignore_first_part = true; foreach($_structure->contentTypeMap() as $mime_id => $mime_type) { //error_log(__METHOD__."($_uid, ".$_structure->getMimeId().") $mime_id: $mime_type"); if (self::$debug) echo __METHOD__."($_uid, partID=".$_structure->getMimeId().") $mime_id: $mime_type
"; - if (!$mime_id) continue; // ignore multipart/mixed itself + if ($ignore_first_part) + { + $ignore_first_part = false; + continue; // ignore multipart/mixed itself + } $part = $_structure->getPart($mime_id); @@ -3355,8 +3365,7 @@ class mail_bo switch($part->getSubType()) { case 'alternative': - $bodyPart[] = $this->getMultipartAlternative($_uid, $part, $_htmlMode, $_preserveSeen); - break; + return array($this->getMultipartAlternative($_uid, $part, $_htmlMode, $_preserveSeen)); case 'mixed': case 'signed':