mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-27 03:49:58 -07:00
NFC: Fix crash on ISO15693-3 save when memory is empty or cannot be read (#4165)
* NFC: Possibly fix ISO15693-3 save crash with no data * Also prevent malloc(0) if block size or count is 0 --------- Co-authored-by: hedger <hedger@users.noreply.github.com>
This commit is contained in:
@@ -37,11 +37,13 @@ void nfc_render_iso15693_3_brief(const Iso15693_3Data* data, FuriString* str) {
|
||||
}
|
||||
|
||||
void nfc_render_iso15693_3_system_info(const Iso15693_3Data* data, FuriString* str) {
|
||||
if(data->system_info.flags & ISO15693_3_SYSINFO_FLAG_MEMORY) {
|
||||
const uint16_t block_count = iso15693_3_get_block_count(data);
|
||||
const uint8_t block_size = iso15693_3_get_block_size(data);
|
||||
|
||||
if((data->system_info.flags & ISO15693_3_SYSINFO_FLAG_MEMORY) &&
|
||||
(block_count > 0 && block_size > 0)) {
|
||||
furi_string_cat(str, "\e#Memory data\n\e*--------------------\n");
|
||||
|
||||
const uint16_t block_count = iso15693_3_get_block_count(data);
|
||||
const uint8_t block_size = iso15693_3_get_block_size(data);
|
||||
const uint16_t display_block_count =
|
||||
MIN(NFC_RENDER_ISO15693_3_MAX_BYTES / block_size, block_count);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user