Skip to content

Commit

Permalink
Applied SUPEE-9652
Browse files Browse the repository at this point in the history
  • Loading branch information
drobinson committed Feb 10, 2017
1 parent 2fc3a12 commit 03835f8
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions lib/Zend/Mail/Transport/Sendmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,19 @@ public function _sendMail()
);
}

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

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

0 comments on commit 03835f8

Please sign in to comment.