mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-02-16 04:09:10 +08:00
fix data load
now not crashing client when entering a folder path without filename
This commit is contained in:
parent
238e41c683
commit
93915858ea
2 changed files with 9 additions and 1 deletions
|
@ -1676,6 +1676,8 @@ static int CmdLoad(const char *Cmd) {
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
|
||||||
len = strlen(Cmd);
|
len = strlen(Cmd);
|
||||||
|
if (len == 0) return PM3_EFILE;
|
||||||
|
|
||||||
if (len > FILE_PATH_SIZE) len = FILE_PATH_SIZE;
|
if (len > FILE_PATH_SIZE) len = FILE_PATH_SIZE;
|
||||||
memcpy(filename, Cmd, len);
|
memcpy(filename, Cmd, len);
|
||||||
|
|
||||||
|
|
|
@ -1014,8 +1014,14 @@ out:
|
||||||
int searchFile(char **foundpath, const char *pm3dir, const char *searchname, const char *suffix, bool silent) {
|
int searchFile(char **foundpath, const char *pm3dir, const char *searchname, const char *suffix, bool silent) {
|
||||||
if (foundpath == NULL)
|
if (foundpath == NULL)
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
|
if (searchname == NULL || strlen(searchname) == 0)
|
||||||
|
return PM3_EINVARG;
|
||||||
|
if (searchname[ strlen(searchname)-1] == '/')
|
||||||
|
return PM3_EINVARG;
|
||||||
|
|
||||||
char *filename = filenamemcopy(searchname, suffix);
|
char *filename = filenamemcopy(searchname, suffix);
|
||||||
if (filename == NULL) return PM3_EMALLOC;
|
if (filename == NULL || strlen(filename) == 0)
|
||||||
|
return PM3_EMALLOC;
|
||||||
int res = searchFinalFile(foundpath, pm3dir, filename, silent);
|
int res = searchFinalFile(foundpath, pm3dir, filename, silent);
|
||||||
if (res != PM3_SUCCESS) {
|
if (res != PM3_SUCCESS) {
|
||||||
if ((res == PM3_EFILE) && (!silent))
|
if ((res == PM3_EFILE) && (!silent))
|
||||||
|
|
Loading…
Reference in a new issue