ArgumentException parsing a valid DNS data
See original GitHub issueI have upgraded to V3, it is great having TXT fields abstraction. But in some domains, it is throwing an ArgumentException: “Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.”
I found that it is happening when CharacterString.GetAllFromArray()
is called
For example, for makingsense.com.
, of message
in base64 is IA+BgAABAAIAAAAAC21ha2luZ3NlbnNlA2NvbQAAEAABwAwAEAABAAADnQBFRGdvb2dsZS1zaXRlLXZlcmlmaWNhdGlvbj1mUTZtaEFzOWlZTEZOWklZSFhJX28yMXNuVUtZbGE5TGgtMDZxOUJWNUpVwAwAEAABAAADnQBAP3Y9c3BmMSBpbmNsdWRlOnNwZi5mcm9tZG9wcGxlci5jb20gaW5jbHVkZTpfc3BmLmdvb2dsZS5jb20gfmFsbA==
and offset
is 45
.
Going deeper, in the 2nd iteration of CharacterString.FromArray()
len
take value of 192
, but offset
is 115
and message.Length
is 190
, so Buffer.BlockCopy(message, offset, data, 0, len);
throws the ArgumentException.
There are a lot of DNS that are throwing that error, I am not sure if DNS data is fine or not, but other tools are reading it fine, for example in this case with MXToolbox.
I would be glad to create a PR with a fix, but my knowledge about DNS standards ir limited.
Do you think that it is possible to apply a workaround to fix or mitigate it?
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (2 by maintainers)
Top GitHub Comments
Thanks for reporting this issue, I’ll take a look.
Thanks, good job!