Skip to content

Commit 7380eac

Browse files
WillyJLhedger
andauthored
NFC: Fix read crash with unexpectedly large MFC AUTH(0) response (#4265)
This was noticeable with Chameleon Ultra NTAG emulation Co-authored-by: hedger <hedger@users.noreply.github.com>
1 parent d19ad60 commit 7380eac

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/nfc/protocols/iso14443_3a/iso14443_3a_poller_i.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,13 @@ static Iso14443_3aError iso14443_3a_poller_standard_frame_exchange(
4242
break;
4343
}
4444

45+
if(bit_buffer_get_capacity_bytes(rx_buffer) <
46+
bit_buffer_get_size_bytes(instance->rx_buffer)) {
47+
ret = Iso14443_3aErrorBufferOverflow;
48+
break;
49+
}
4550
bit_buffer_copy(rx_buffer, instance->rx_buffer);
51+
4652
if(!iso14443_crc_check(Iso14443CrcTypeA, instance->rx_buffer)) {
4753
ret = Iso14443_3aErrorWrongCrc;
4854
break;

0 commit comments

Comments
 (0)