Skip to content

Commit f8fa71c

Browse files
zinongliskotopes
andauthored
NFC TRT Parser: Additional checks to prevent false positives (#3966)
* additional checks to prevent false positives * Update trt.c Co-authored-by: あく <[email protected]>
1 parent 1822221 commit f8fa71c

File tree

1 file changed

+4
-1
lines changed
  • applications/main/nfc/plugins/supported_cards

1 file changed

+4
-1
lines changed

applications/main/nfc/plugins/supported_cards/trt.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ static bool trt_parse(const NfcDevice* device, FuriString* parsed_data) {
4040
const uint8_t* full_record_pointer = &data->page[FULL_SALE_TIME_STAMP_PAGE].data[0];
4141
uint32_t latest_sale_record = bit_lib_get_bits_32(partial_record_pointer, 3, 20);
4242
uint32_t latest_sale_full_record = bit_lib_get_bits_32(full_record_pointer, 0, 27);
43-
if(latest_sale_record != (latest_sale_full_record & 0xFFFFF)) break;
43+
if(latest_sale_record != (latest_sale_full_record & 0xFFFFF))
44+
break; // check if the copy matches
45+
if((latest_sale_record == 0) || (latest_sale_full_record == 0))
46+
break; // prevent false positive
4447

4548
// Parse date
4649
// yyy yyyymmmm dddddhhh hhnnnnnn

0 commit comments

Comments
 (0)