Fix EMV crash

This commit is contained in:
MX
2026-03-29 14:31:50 +03:00
parent a5f6285e91
commit ecc3e78efa
3 changed files with 6 additions and 4 deletions
+4 -1
View File
@@ -172,7 +172,10 @@ bool iso14443_4_layer_decode_response(
bit_buffer_copy_right(output_data, block_data, 1);
} else {
if(!bit_buffer_starts_with_byte(block_data, instance->pcb_prev)) break;
bit_buffer_copy_right(output_data, block_data, 1);
// Fix for some EMV cards with strange response
if(bit_buffer_get_size_bytes(block_data) > 1) {
bit_buffer_copy_right(output_data, block_data, 1);
}
ret = true;
}
} while(false);
-1
View File
@@ -58,7 +58,6 @@ void bit_buffer_copy_right(BitBuffer* buf, const BitBuffer* other, size_t start_
furi_check(buf);
furi_check(other);
furi_check(bit_buffer_get_size_bytes(other) > start_index);
// TODO: Fix crash
furi_check(buf->capacity_bytes >= bit_buffer_get_size_bytes(other) - start_index);
memcpy(buf->data, other->data + start_index, bit_buffer_get_size_bytes(other) - start_index);