Skip to content

pn532: bump InListPassiveTarget response_length to 64 to handle long ATS - #70

Merged
FoamyGuy merged 1 commit into
adafruit:mainfrom
gdudek:fix/long-ats-buffer
Jan 14, 2026
Merged

pn532: bump InListPassiveTarget response_length to 64 to handle long ATS#70
FoamyGuy merged 1 commit into
adafruit:mainfrom
gdudek:fix/long-ats-buffer

Conversation

@gdudek

@gdudek gdudek commented Aug 2, 2025

Copy link
Copy Markdown
Contributor

pn532: bump InListPassiveTarget response_length to 64 to handle long ATS

Some ISO14443-A/EMV cards return longer ATS in the 0x4A response.
The previous 30–44 byte bound can truncate and trigger checksum errors.
Using 64 provides safe headroom with no behavior change for shorter replies.

What changed
In get_passive_target() (106A path), increase:

response_length=30
to:
response_length=64

Rationale
call_function(..., response_length=N) is an upper bound, not a strict size. Longer ATS payloads (ATSLen + ATS) can push total reply length past 30–44 bytes; truncation leads to the checksum mismatch. Using 64 is conservative and low-risk. A value of 44 works well for me and fixed the error I was seeing, but I used 64 for future-proofing.

Backwards compatibility / risk
Very low. Only increases the allowed maximum response size for a single command; no API changes.

@FoamyGuy FoamyGuy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me, Thank you!

@FoamyGuy
FoamyGuy merged commit 1453393 into adafruit:main Jan 14, 2026
1 check passed
adafruit-adabot pushed a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Jan 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants