laminas / laminas-mail

Provides generalized functionality to compose and send both text and MIME-compliant multipart e-mail messages
https://docs.laminas.dev/laminas-mail/
BSD 3-Clause "New" or "Revised" License
95 stars 64 forks source link

getFolders - Parsing literals ends into a endless loop #38

Open michalbundyra opened 4 years ago

michalbundyra commented 4 years ago

When a response contains a literal php ends in an endless loop.

See RFC about literals: https://tools.ietf.org/html/rfc3501#section-4.3

Below a snippet of the response of imap command A1 LIST "" *

* LIST (\HasNoChildren) "/" {16}
Intern/test "23"

This snippet is the cause of the endless loop. Problem seems to be the appending of a space in Zend\Mail\Protocol in method decodeLine. $line = trim($line) . ' '; should be

$line = trim($line) ;


Originally posted by @fasterforward at https://github.com/zendframework/zend-mail/issues/191

michalbundyra commented 4 years ago

Is there a solution for this currently? because removing the space doesn't fix it for me


Originally posted by @canaan5 at https://github.com/zendframework/zend-mail/issues/191#issuecomment-386883261

michalbundyra commented 4 years ago

Oh didn't see this issue. Same thing here:

240

https://github.com/zendframework/zend-mail/issues/240 I have a gues to what line causes it. Removing that extra space on the mentioned line seams to work. But I guess someone needs to write a test and make a pull request etc. etc. Its a very serious flaw that makes scripts hang completely/indefinitely.


Originally posted by @jensstalder at https://github.com/zendframework/zend-mail/issues/191#issuecomment-525310140