X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/5b4664e79f6b6a6e1e8dc2ae0284cab948e25b09..53f7c75a38a18e79313e7bd5f664a11a73db5307:/client/cmdhfmf.c diff --git a/client/cmdhfmf.c b/client/cmdhfmf.c index 16dd6f28..dc8f7898 100644 --- a/client/cmdhfmf.c +++ b/client/cmdhfmf.c @@ -475,6 +475,7 @@ int CmdHF14AMfDump(const char *Cmd) { if ( bytes_read == 0) { PrintAndLog("File reading error."); fclose(fin); + fin = NULL; return 2; } } @@ -485,12 +486,14 @@ int CmdHF14AMfDump(const char *Cmd) { if ( bytes_read == 0) { PrintAndLog("File reading error."); fclose(fin); + fin = NULL; return 2; } } fclose(fin); - + fin = NULL; + PrintAndLog("|-----------------------------------------|"); PrintAndLog("|------ Reading sector access bits...-----|"); PrintAndLog("|-----------------------------------------|"); @@ -596,6 +599,7 @@ int CmdHF14AMfDump(const char *Cmd) { uint16_t numblocks = FirstBlockOfSector(numSectors - 1) + NumBlocksPerSector(numSectors - 1); fwrite(carddata, 1, 16*numblocks, fout); fclose(fout); + fout = NULL; PrintAndLog("Dumped %d blocks (%d bytes) to file dumpdata.bin", numblocks, 16*numblocks); } @@ -644,6 +648,7 @@ int CmdHF14AMfRestore(const char *Cmd) { if ( bytes_read == 0) { PrintAndLog("File reading error (dumpkeys.bin)."); fclose(fkeys); + fkeys = NULL; return 2; } } @@ -653,6 +658,7 @@ int CmdHF14AMfRestore(const char *Cmd) { if ( bytes_read == 0) { PrintAndLog("File reading error (dumpkeys.bin)."); fclose(fkeys); + fkeys = NULL; return 2; } } @@ -673,6 +679,7 @@ int CmdHF14AMfRestore(const char *Cmd) { if ( bytes_read == 0) { PrintAndLog("File reading error (dumpdata.bin)."); fclose(fdump); + fdump = NULL; return 2; } @@ -708,6 +715,7 @@ int CmdHF14AMfRestore(const char *Cmd) { } fclose(fdump); + fdump = NULL; return 0; } @@ -1050,7 +1058,7 @@ int CmdHF14AMfNestedHard(const char *Cmd) { slow ? "Yes" : "No", tests); - int16_t isOK = mfnestedhard(blockNo, keyType, key, trgBlockNo, trgKeyType, know_target_key?trgkey:NULL, nonce_file_read, nonce_file_write, slow, tests); + int16_t isOK = mfnestedhard(blockNo, keyType, key, trgBlockNo, trgKeyType, know_target_key ? trgkey : NULL, nonce_file_read, nonce_file_write, slow, tests); if (isOK) { switch (isOK) {