mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-07-30 11:39:14 -07:00
improved the messages reported when loading json files fails. Usually because we have reserved the wrong size memory
This commit is contained in:
parent
8bfb915624
commit
39eecc917e
2 changed files with 18 additions and 13 deletions
|
@ -2085,6 +2085,9 @@ int pm3_load_dump(const char *fn, void **pdump, size_t *dumplen, size_t maxdumpl
|
|||
}
|
||||
case EML: {
|
||||
res = loadFileEML_safe(fn, pdump, dumplen);
|
||||
if (res == PM3_ESOFT) {
|
||||
PrintAndLogEx(WARNING, "file IO failed");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case JSON: {
|
||||
|
@ -2094,8 +2097,15 @@ int pm3_load_dump(const char *fn, void **pdump, size_t *dumplen, size_t maxdumpl
|
|||
return PM3_EMALLOC;
|
||||
}
|
||||
res = loadFileJSON(fn, *pdump, maxdumplen, dumplen, NULL);
|
||||
if (res != PM3_SUCCESS) {
|
||||
free(*pdump);
|
||||
if (res == PM3_SUCCESS)
|
||||
return res;
|
||||
|
||||
free(*pdump);
|
||||
|
||||
if (res == PM3_ESOFT) {
|
||||
PrintAndLogEx(WARNING, "JSON objects failed to load");
|
||||
} else if (res == PM3_EMALLOC) {
|
||||
PrintAndLogEx(WARNING, "Wrong size of allocated memory. Check your parameters");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -2109,11 +2119,6 @@ int pm3_load_dump(const char *fn, void **pdump, size_t *dumplen, size_t maxdumpl
|
|||
}
|
||||
}
|
||||
|
||||
if (res != PM3_SUCCESS) {
|
||||
PrintAndLogEx(WARNING, "file not found or locked `" _YELLOW_("%s") "`", fn);
|
||||
return PM3_EFILE;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue