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

commands: CmdPowerOn: Fix nlength return value in overflow case #130

Closed
wants to merge 1 commit into from

Conversation

drinkcat
Copy link
Contributor

@drinkcat drinkcat commented Apr 7, 2024

CmdPowerOn is supposed to return ATR and its length in buffer/nlength.

A bounds check is performed in the code, and truncates atr_len to the length of the received data (minus 10 bytes for the header). However, in that case, nlength in not updated, leading to a returned ATR with trailing garbage.

This is an edge, error case, that should never happen, and was introduced while fixing a potentially more serious buffer overrun in 2020.

Fixes: a382095 ("CmdPowerOn: fix a potention overrun with bogus ATR")

CmdPowerOn is supposed to return ATR and its length in
buffer/nlength.

A bounds check is performed in the code, and truncates atr_len
to the length of the received data (minus 10 bytes for the header).
However, in that case, nlength in not updated, leading to a returned
ATR with trailing garbage.

This is an edge, error case, that should never happen, and was
introduced while fixing a potentially more serious buffer overrun
in 2020.

Fixes: a382095 ("CmdPowerOn: fix a potention overrun with bogus ATR")
@LudovicRousseau
Copy link
Owner

Fixed in ba4775a

Thanks

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.

None yet

2 participants