Skip to content

Commit

Permalink
decode ATS if present (ISO 14443-4 card) (#2347)
Browse files Browse the repository at this point in the history
Co-authored-by: John D. Bruner <[email protected]>
  • Loading branch information
jdbruner and John D. Bruner authored Aug 21, 2024
1 parent 4fe8e8b commit 9c5d89f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/devices/Pn532/Pn532.cs
Original file line number Diff line number Diff line change
Expand Up @@ -575,12 +575,14 @@ private bool SetParameters(ParametersFlags parametersFlags)
nfcId[i] = toDecode[5 + i];
}

if ((5 + nfcId.Length) > toDecode.Length)
if ((5 + nfcId.Length) < toDecode.Length)
{
// The first byte of the ATS is the length,
// which includes itself.
ats = new byte[toDecode[5 + nfcId.Length]];
for (int i = 0; i < ats.Length; i++)
{
ats[i] = toDecode[6 + nfcId.Length + i];
ats[i] = toDecode[5 + nfcId.Length + i];
}
}

Expand Down

0 comments on commit 9c5d89f

Please sign in to comment.