forked from PHPMailer/PHPMailer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request from GHSA-f7hx-fqxw-rvvj
* Initial fixes, tests, and bump to 6.1.6 * Add CVE number
- Loading branch information
Showing
7 changed files
with
96 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
6.1.5 | ||
6.1.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1214,7 +1214,7 @@ public function testHTMLAttachment() | |
} | ||
|
||
//Make sure that trying to attach a nonexistent file fails | ||
$filename = __FILE__ . md5(microtime()). 'nonexistent_file.txt'; | ||
$filename = __FILE__ . md5(microtime()) . 'nonexistent_file.txt'; | ||
$this->assertFalse($this->Mail->addAttachment($filename)); | ||
//Make sure that trying to attach an existing but unreadable file fails | ||
touch($filename); | ||
|
@@ -1227,6 +1227,62 @@ public function testHTMLAttachment() | |
$this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo); | ||
} | ||
|
||
/** | ||
* Attachment naming test. | ||
*/ | ||
public function testAttachmentNaming() | ||
{ | ||
$this->Mail->Body = 'Attachments.'; | ||
$this->Mail->Subject .= ': Attachments'; | ||
$this->Mail->isHTML(true); | ||
$this->Mail->CharSet = 'UTF-8'; | ||
$this->Mail->addAttachment( | ||
realpath($this->INCLUDE_DIR . '/examples/images/phpmailer_mini.png'), | ||
'phpmailer_mini.png";.jpg' | ||
); | ||
$this->Mail->addAttachment( | ||
realpath($this->INCLUDE_DIR . '/examples/images/phpmailer.png'), | ||
'phpmailer.png' | ||
); | ||
$this->Mail->addAttachment( | ||
realpath($this->INCLUDE_DIR . '/examples/images/PHPMailer card logo.png'), | ||
'PHPMailer card logo.png' | ||
); | ||
$this->buildBody(); | ||
$this->Mail->preSend(); | ||
$message = $this->Mail->getSentMIMEMessage(); | ||
$this->assertContains( | ||
'Content-Type: image/png; name="phpmailer_mini.png\";.jpg"', | ||
$message, | ||
'Name containing double quote should be escaped in Content-Type' | ||
); | ||
$this->assertContains( | ||
'Content-Disposition: attachment; filename="phpmailer_mini.png\";.jpg"', | ||
$message, | ||
'Filename containing double quote should be escaped in Content-Disposition' | ||
); | ||
$this->assertContains( | ||
'Content-Type: image/png; name=phpmailer.png', | ||
$message, | ||
'Name without special chars should not be quoted in Content-Type' | ||
); | ||
$this->assertContains( | ||
'Content-Disposition: attachment; filename=phpmailer.png', | ||
$message, | ||
'Filename without special chars should not be quoted in Content-Disposition' | ||
); | ||
$this->assertContains( | ||
'Content-Type: image/png; name="PHPMailer card logo.png"', | ||
$message, | ||
'Name with spaces should be quoted in Content-Type' | ||
); | ||
$this->assertContains( | ||
'Content-Disposition: attachment; filename="PHPMailer card logo.png"', | ||
$message, | ||
'Filename with spaces should be quoted in Content-Disposition' | ||
); | ||
} | ||
|
||
/** | ||
* Test embedded image without a name. | ||
*/ | ||
|
@@ -1687,7 +1743,7 @@ public function testAddressSplitting() | |
['name' => 'Jill User', 'address' => '[email protected]'], | ||
['name' => '', 'address' => '[email protected]'], | ||
], | ||
$this->Mail->parseAddresses( | ||
PHPMailer::parseAddresses( | ||
'Joe User <[email protected]>,' | ||
. 'Jill User <[email protected]>,' | ||
. '[email protected],' | ||
|