Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SmtpStream.QueueCommand goes to endless loop in TryQueueCommand #1568

Closed
alexander-kucherov opened this issue May 12, 2023 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@alexander-kucherov
Copy link

Describe the bug
SmtpStream.QueueCommand goes to endless loop in TryQueueCommand if command length is greater than output buffer size (4096).
It was broken by commit
In my case needed bytes always greater than 4096 and it always return false. Callsite has while loop

			while (!TryQueueCommand (encoder, command, ref index))
				Flush (cancellationToken);

In this case it's endless.

Platform (please complete the following information):

  • OS: Windows
  • .NET Runtime: net7.0
  • MailKit Version: All versions >3.4.3

Exception
No exception. Endless loop

To Reproduce
I've prepared a unit test to reproduce bug

		[Test]
		public void EndlessLoopOnQueueCommand ()
		{
			using var stream = new SmtpStream (new DummyNetworkStream (), new NullProtocolLogger ());
			var memory = (MemoryStream) stream.Stream;
			var command = "AUTH GSSAPI YIIkMgYGK"+ new string ('X', 4096);
			stream.QueueCommand (command, default);
		}

Additional context
I've implemented a custom SaslMechanism for GSSAPI Kerberos. So my outgoing blob is greater than 4096 and i have problems which described above.

@jstedfast
Copy link
Owner

Thanks, I'll try to look into this soon

@jstedfast jstedfast added the bug Something isn't working label May 14, 2023
@alexander-kucherov
Copy link
Author

Thanks a lot for your quick fix.
I'm looking forward for a new release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants