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

fix nfc oob write #435

Merged
merged 2 commits into from
Oct 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/os_io_seproxyhal.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,13 @@ void io_seproxyhal_handle_capdu_event(void)
#ifdef HAVE_NFC
void io_seproxyhal_handle_nfc_recv_event(void)
{
size_t max = MIN(sizeof(G_io_apdu_buffer), sizeof(G_io_seproxyhal_spi_buffer) - 3);
size_t size = U2BE(G_io_seproxyhal_spi_buffer, 1);

G_io_app.apdu_media = IO_APDU_MEDIA_NFC;
G_io_app.apdu_state = APDU_NFC;
G_io_app.apdu_length = ((G_io_seproxyhal_spi_buffer[1] << 8) & 0xFF00)
| (G_io_seproxyhal_spi_buffer[2] & 0x00FF);
G_io_app.apdu_length = MIN(size, max);

memcpy(G_io_apdu_buffer, &G_io_seproxyhal_spi_buffer[3], G_io_app.apdu_length);
}
#endif
Expand Down