bad logic

This commit is contained in:
iceman1001 2019-03-18 22:14:07 +01:00
parent 580159ed97
commit b9cbc5cb7f

View file

@ -425,34 +425,33 @@ int CmdHFFelicaDumpLite(const char *Cmd) {
}
uint64_t tracelen = resp.arg[1];
if (tracelen == 0)
return 1;
uint8_t *trace = calloc(tracelen, sizeof(uint8_t));
if (trace == NULL) {
PrintAndLogEx(WARNING, "Cannot allocate memory for trace");
return 1;
}
// only download data if there is any.
if (tracelen > 0) {
if (!GetFromDevice(BIG_BUF, trace, tracelen, 0, NULL, 2500, false)) {
PrintAndLogEx(WARNING, "command execution time out");
free(trace);
return 0;
}
PrintAndLogEx(SUCCESS, "Recorded Activity (trace len = %d bytes)", tracelen);
print_hex_break(trace, tracelen, 32);
printSep();
uint16_t tracepos = 0;
while (tracepos < tracelen)
tracepos = PrintFliteBlock(tracepos, trace, tracelen);
printSep();
if (!GetFromDevice(BIG_BUF, trace, tracelen, 0, NULL, 2500, false)) {
PrintAndLogEx(WARNING, "command execution time out");
free(trace);
return 0;
}
free(trace);
PrintAndLogEx(SUCCESS, "Recorded Activity (trace len = %d bytes)", tracelen);
print_hex_break(trace, tracelen, 32);
printSep();
uint16_t tracepos = 0;
while (tracepos < tracelen)
tracepos = PrintFliteBlock(tracepos, trace, tracelen);
printSep();
free(trace);
return 0;
}