From 5dd640ff604595de369880e8f380948ae069b449 Mon Sep 17 00:00:00 2001 From: Willy-JL <49810075+Willy-JL@users.noreply.github.com> Date: Tue, 28 May 2024 05:48:53 +0100 Subject: [PATCH] NFC: Fix Mifare DESFire reading --- lib/nfc/helpers/iso14443_4_layer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/nfc/helpers/iso14443_4_layer.c b/lib/nfc/helpers/iso14443_4_layer.c index 0e742ce958..73100591a4 100644 --- a/lib/nfc/helpers/iso14443_4_layer.c +++ b/lib/nfc/helpers/iso14443_4_layer.c @@ -68,7 +68,9 @@ bool iso14443_4_layer_decode_block( // TODO: Fix properly! this is a very big kostyl na velosipede // (bit_buffer_copy_right are called to copy bigger buffer into smaller buffer causing crash on furi check) issue comes iso14443_4a_poller_send_block at line 109 - if(bit_buffer_get_size_bytes(output_data) < bit_buffer_get_size_bytes(output_data) - 1) + // Mimicks furi_check()s in bit_buffer_copy_right(): buf=output_data other=block_data start_index=1 + if(!(bit_buffer_get_size_bytes(block_data) > 1)) return ret; + if(!(bit_buffer_get_capacity_bytes(output_data) >= bit_buffer_get_size_bytes(block_data) - 1)) return ret; do {