Skip to content

Commit

Permalink
Apply SUPEE-9652/10570
Browse files Browse the repository at this point in the history
  • Loading branch information
sreichel committed Dec 8, 2022
1 parent 66f96b4 commit 6545737
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions library/Zend/Mail/Transport/Sendmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,20 @@ public function _sendMail()
);
}

set_error_handler([$this, '_handleMailErrors']);
$result = mail(
$this->recipients,
$this->_mail->getSubject(),
$this->body,
$this->header,
$this->parameters);
restore_error_handler();
$fromEmailHeader = str_replace(' ', '', $this->parameters);
// Sanitize the From header
if (!Zend_Validate::is($fromEmailHeader, 'EmailAddress')) {
throw new Zend_Mail_Transport_Exception('Potential code injection in From header');
} else {
set_error_handler([$this, '_handleMailErrors']);
$result = mail(
$this->recipients,
$this->_mail->getSubject(),
$this->body,
$this->header,
$fromEmailHeader);
restore_error_handler();
}
}

if ($this->_errstr !== null || !$result) {
Expand Down

0 comments on commit 6545737

Please sign in to comment.