Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

fix infinite loop#32

Merged
weierophinney merged 6 commits intozendframework:masterfrom
EugenGanshorn:master
May 14, 2018
Merged

fix infinite loop#32
weierophinney merged 6 commits intozendframework:masterfrom
EugenGanshorn:master

Conversation

@EugenGanshorn
Copy link
Contributor

If a message contains 72 spaces and 72 dots at one line we have an infinite loop. This pull request fix this behavior.
I'll replace the last space at one line always with =20. I'll also replace the first dot at one line always with =2E.
Swiftmail do it the same way and it works fine.

src/Mime.php Outdated
// Check if there is a space at the end of the line and rewind
if ($ptr > 0 && $str[$ptr - 1] == ' ') {
--$ptr;
switch (ord($str[0])) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe an if instead of a switch?

src/Mime.php Outdated
if ($ptr > 0 && $str[$ptr - 1] == ' ') {
--$ptr;
switch (ord($str[0])) {
case 0x2E:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be easier to read if you add an comment with the translation of the hex code

break;
}

switch (ord(substr($str, $ptr - 1))) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you got these code from somethere else? please add a link in comments or commit message

Copy link

@Rfrost92 Rfrost92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested these changes in our mail system, everything seems to work fine. The bug is fixed

@weierophinney weierophinney merged commit 07e108b into zendframework:master May 14, 2018
weierophinney added a commit that referenced this pull request May 14, 2018
weierophinney added a commit that referenced this pull request May 14, 2018
weierophinney added a commit that referenced this pull request May 14, 2018
weierophinney added a commit that referenced this pull request May 14, 2018
Forward port #32

Conflicts:
	CHANGELOG.md
@weierophinney
Copy link
Member

Thanks, @EugenGanshorn.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants