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

AuthenticationResults.TryParse throws if string ends in header.from= #581

Closed
The-Nutty opened this issue Jun 9, 2020 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@The-Nutty
Copy link

Describe the bug
When passing authentication results like the following test.com; dkim=none (message not signed) header.d=none; test.com; dmarc=none action="none" header.from= (generated by office 365) the following line of code will throw (as opposed to parse successfully as i think it should or fail saliently and return false)

            Console.WriteLine(AuthenticationResults.TryParse(Encoding.UTF8.GetBytes((string) "test.com; dkim=none (message not signed) header.d=none; test.com; dmarc=none action=\"none\" header.from="), out var a));

Platform (please complete the following information):

  • OS: Windows
  • .NET Runtime: core 3.1
  • MimeKit Version: tested 2.7 and 2.8

To Reproduce
Run the code sample in the description, will throw the following exception

Unhandled exception. System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at MimeKit.Cryptography.AuthenticationResults.SkipPropertyValue(Byte[] text, Int32& index, Int32 endIndex, Boolean& quoted)
   at MimeKit.Cryptography.AuthenticationResults.TryParseMethods(Byte[] text, Int32& index, Int32 endIndex, Boolean throwOnError, AuthenticationResults authres)
   at MimeKit.Cryptography.AuthenticationResults.TryParse(Byte[] text, Int32& index, Int32 endIndex, Boolean throwOnError, AuthenticationResults& authres)
   at MimeKit.Cryptography.AuthenticationResults.TryParse(Byte[] buffer, AuthenticationResults& authres)

Expected behavior
Passes without error

@jstedfast jstedfast added the bug Something isn't working label Jun 10, 2020
jstedfast added a commit that referenced this issue Jun 10, 2020
@jstedfast
Copy link
Owner

Thanks! Should be fixed now.

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