Fix some NFC/PN532 crashes (#4678)

* Add + use some constants, fix some crashes

* Fix PN532 crashes
This commit is contained in:
Keith Burzinski
2023-04-11 21:29:06 -05:00
committed by GitHub
parent 3d7d689040
commit 5a4840f641
5 changed files with 31 additions and 9 deletions
@@ -52,7 +52,13 @@ std::unique_ptr<nfc::NfcTag> PN532::read_mifare_classic_tag_(std::vector<uint8_t
current_block++;
}
}
buffer.erase(buffer.begin(), buffer.begin() + message_start_index);
if (buffer.begin() + message_start_index < buffer.end()) {
buffer.erase(buffer.begin(), buffer.begin() + message_start_index);
} else {
return make_unique<nfc::NfcTag>(uid, nfc::MIFARE_CLASSIC);
}
return make_unique<nfc::NfcTag>(uid, nfc::MIFARE_CLASSIC, buffer);
}