From f8fa71c575b2bf14d26c0ab6f5a4b0e4d6fb99d9 Mon Sep 17 00:00:00 2001 From: Zinong Li <131403964+zinongli@users.noreply.github.com> Date: Sun, 20 Oct 2024 23:58:33 +0800 Subject: [PATCH] NFC TRT Parser: Additional checks to prevent false positives (#3966) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * additional checks to prevent false positives * Update trt.c Co-authored-by: あく --- applications/main/nfc/plugins/supported_cards/trt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/applications/main/nfc/plugins/supported_cards/trt.c b/applications/main/nfc/plugins/supported_cards/trt.c index 5407ab1f7..793ad7f2d 100644 --- a/applications/main/nfc/plugins/supported_cards/trt.c +++ b/applications/main/nfc/plugins/supported_cards/trt.c @@ -40,7 +40,10 @@ static bool trt_parse(const NfcDevice* device, FuriString* parsed_data) { const uint8_t* full_record_pointer = &data->page[FULL_SALE_TIME_STAMP_PAGE].data[0]; uint32_t latest_sale_record = bit_lib_get_bits_32(partial_record_pointer, 3, 20); uint32_t latest_sale_full_record = bit_lib_get_bits_32(full_record_pointer, 0, 27); - if(latest_sale_record != (latest_sale_full_record & 0xFFFFF)) break; + if(latest_sale_record != (latest_sale_full_record & 0xFFFFF)) + break; // check if the copy matches + if((latest_sale_record == 0) || (latest_sale_full_record == 0)) + break; // prevent false positive // Parse date // yyy yyyymmmm dddddhhh hhnnnnnn