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

InDataExchange() has wrong size limits #124

Open
mhaberler opened this issue Dec 9, 2023 · 0 comments
Open

InDataExchange() has wrong size limits #124

mhaberler opened this issue Dec 9, 2023 · 0 comments

Comments

@mhaberler
Copy link

This is the signature of inDataExchange():

bool Adafruit_PN532::inDataExchange(uint8_t *send, uint8_t sendLength,
                                    uint8_t *response,
                                    uint8_t *responseLength) 

Further down in the code the response is limited to 64 bytes (size of packet_buffer)

Please see section 7.3.8 InDataExchange of the PN532 User Manual which states:

DataOut is an array of raw data (from 0 up to 262 bytes) to be sent to the target
by the PN532 ...
DataIn is an array of raw data (from 0 up to 262 bytes) received by the PN532..

so we have:

  • packet_buffer is too small (I guess this was a mixup with the PN532 FIFO size)
  • with uint8_t sendLength, *responseLength the limit is still to low at 255

This shows up if you try to read an NDEF message which wont fit the packet_buffer limit, and eventually causes a crash of the NDEF parser.

I will post code which shows the error and a PR for a fix later.

unfortunately this means a signature change buf IMO cannot be avoided.

Michael

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

No branches or pull requests

1 participant