Merge pull request #2864 from Antiklesys/master

Updated hf iclass tear to break endless read loop
This commit is contained in:
Iceman 2025-05-26 19:37:43 +02:00 committed by GitHub
commit 744107035f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3219,7 +3219,7 @@ static int CmdHFiClass_TearBlock(const char *Cmd) {
first_read = false; first_read = false;
reread = false; reread = false;
bool decrease = false; bool decrease = false;
int readcount = 0;
while (first_read == false) { while (first_read == false) {
if (kbd_enter_pressed()) { if (kbd_enter_pressed()) {
@ -3246,6 +3246,12 @@ static int CmdHFiClass_TearBlock(const char *Cmd) {
} else if (res != PM3_SUCCESS) { } else if (res != PM3_SUCCESS) {
decrease = true; decrease = true;
} }
if (readcount >= 10){
PrintAndLogEx(WARNING, "\n"_RED_("Read failed too many times, giving up"));
isok = PM3_EFAILED;
goto out;
}
readcount++;
} }
// if there was an error reading repeat the tearoff with the same delay // if there was an error reading repeat the tearoff with the same delay