fix hf search (#908)

* fix memory access violation in HF14B_Other_Reader()
This commit is contained in:
pwpiwi 2020-01-07 22:33:55 +01:00 committed by GitHub
parent fef3084ec2
commit f0c48553cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -529,22 +529,21 @@ static bool HF14B_ST_Info(bool verbose) {
// test for other 14b type tags (mimic another reader - don't have tags to identify) // test for other 14b type tags (mimic another reader - don't have tags to identify)
static bool HF14B_Other_Reader(bool verbose) { static bool HF14B_Other_Reader(uint8_t *data, bool verbose) {
uint8_t data[4];
uint8_t datalen; uint8_t datalen;
bool crc = true; bool crc = true;
datalen = 4;
//std read cmd //std read cmd
data[0] = 0x00; data[0] = 0x00;
data[1] = 0x0b; data[1] = 0x0b;
data[2] = 0x3f; data[2] = 0x3f;
data[3] = 0x80; data[3] = 0x80;
datalen = 4;
if (HF14BCmdRaw(true, &crc, true, data, &datalen, false) != 0) { if (HF14BCmdRaw(true, &crc, true, data, &datalen, false) != 0) {
if (datalen > 2 || !crc) { if (datalen > 2 || !crc) {
PrintAndLog ("\n14443-3b tag found:"); PrintAndLog ("\n14443-3b tag found:");
PrintAndLog ("Unknown tag type answered to a 0x000b3f80 command ans:"); PrintAndLog ("Unknown tag type answered to a 0x000b3f80 command:");
PrintAndLog ("%s", sprint_hex(data, datalen)); PrintAndLog ("%s", sprint_hex(data, datalen));
switch_off_field_14b(); switch_off_field_14b();
return true; return true;
@ -558,7 +557,7 @@ static bool HF14B_Other_Reader(bool verbose) {
if (HF14BCmdRaw(true, &crc, true, data, &datalen, false) != 0) { if (HF14BCmdRaw(true, &crc, true, data, &datalen, false) != 0) {
if (datalen > 0) { if (datalen > 0) {
PrintAndLog ("\n14443-3b tag found:"); PrintAndLog ("\n14443-3b tag found:");
PrintAndLog ("Unknown tag type answered to a 0x0A command ans:"); PrintAndLog ("Unknown tag type answered to a 0x0A command:");
PrintAndLog ("%s", sprint_hex(data, datalen)); PrintAndLog ("%s", sprint_hex(data, datalen));
switch_off_field_14b(); switch_off_field_14b();
return true; return true;
@ -572,7 +571,7 @@ static bool HF14B_Other_Reader(bool verbose) {
if (HF14BCmdRaw(true, &crc, true, data, &datalen, false) != 0) { if (HF14BCmdRaw(true, &crc, true, data, &datalen, false) != 0) {
if (datalen > 0) { if (datalen > 0) {
PrintAndLog ("\n14443-3b tag found:"); PrintAndLog ("\n14443-3b tag found:");
PrintAndLog ("Unknown tag type answered to a 0x0C command ans:"); PrintAndLog ("Unknown tag type answered to a 0x0C command:");
PrintAndLog ("%s", sprint_hex(data, datalen)); PrintAndLog ("%s", sprint_hex(data, datalen));
switch_off_field_14b(); switch_off_field_14b();
return true; return true;
@ -606,7 +605,7 @@ int infoHF14B(bool verbose) {
// try unknown 14b read commands (to be identified later) // try unknown 14b read commands (to be identified later)
// could be read of calypso, CEPAS, moneo, or pico pass. // could be read of calypso, CEPAS, moneo, or pico pass.
if (HF14B_Other_Reader(verbose)) return 1; if (HF14B_Other_Reader(data, verbose)) return 1;
if (verbose) PrintAndLog("no 14443B tag found"); if (verbose) PrintAndLog("no 14443B tag found");
return 0; return 0;
@ -636,7 +635,7 @@ int readHF14B(bool verbose){
// try unknown 14b read commands (to be identified later) // try unknown 14b read commands (to be identified later)
// could be read of calypso, CEPAS, moneo, or pico pass. // could be read of calypso, CEPAS, moneo, or pico pass.
if (HF14B_Other_Reader(verbose)) return 1; if (HF14B_Other_Reader(data, verbose)) return 1;
if (verbose) PrintAndLog("no 14443B tag found"); if (verbose) PrintAndLog("no 14443B tag found");
return 0; return 0;