Skip to content

Commit 03835f8

Browse files
committed
Applied SUPEE-9652
1 parent 2fc3a12 commit 03835f8

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

lib/Zend/Mail/Transport/Sendmail.php

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,19 @@ public function _sendMail()
119119
);
120120
}
121121

122-
set_error_handler(array($this, '_handleMailErrors'));
123-
$result = mail(
124-
$this->recipients,
125-
$this->_mail->getSubject(),
126-
$this->body,
127-
$this->header,
128-
$this->parameters);
129-
restore_error_handler();
122+
// Sanitize the From header
123+
if (!Zend_Validate::is(str_replace(' ', '', $this->parameters), 'EmailAddress')) {
124+
throw new Zend_Mail_Transport_Exception('Potential code injection in From header');
125+
} else {
126+
set_error_handler(array($this, '_handleMailErrors'));
127+
$result = mail(
128+
$this->recipients,
129+
$this->_mail->getSubject(),
130+
$this->body,
131+
$this->header,
132+
$this->parameters);
133+
restore_error_handler();
134+
}
130135
}
131136

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

0 commit comments

Comments
 (0)