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

Check the length of an NDEF message before checking the end terminator #2288

Merged
merged 1 commit into from
Mar 25, 2024

Conversation

pete-intranel
Copy link
Contributor

@pete-intranel pete-intranel commented Mar 4, 2024

Fixes #2286

Check the length of an NDEF message before checking the end terminator TLV as it is optional and could result in an IndexOfOfRangeException.

Both MifareCard and UltralightCard trim the message on block boundaries before processing the message. This means that if the end of the message falls exactly at the end of a block boundary, the end terminator TLV is trimmed off, causing the descrbed exception.

Microsoft Reviewers: Open in CodeFlow

…r as it is optional and could result in an IndexOfOfRangeException
@pete-intranel
Copy link
Contributor Author

pete-intranel commented Mar 4, 2024 via email

Copy link
Member

@Ellerbach Ellerbach left a comment

Choose a reason for hiding this comment

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

Thanks for the PR following the discussion in the issue. It looks good to me!

@Ellerbach
Copy link
Member

azp /run

@joperezr
Copy link
Member

/azp run dotnet.iot

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@Ellerbach Ellerbach merged commit 09a9dd4 into dotnet:main Mar 25, 2024
11 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Apr 27, 2024
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.

TryReadNdefMessage can trim off terminator TLV (0xFE) causing validation to throw exception
3 participants