fix data load now not crashing client when entering a folder path without filename

This commit is contained in:
iceman1001 2019-09-21 08:47:12 +02:00
commit 93915858ea
2 changed files with 9 additions and 1 deletions

View file

@ -1014,8 +1014,14 @@ out:
int searchFile(char **foundpath, const char *pm3dir, const char *searchname, const char *suffix, bool silent) {
if (foundpath == NULL)
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);
if (filename == NULL) return PM3_EMALLOC;
if (filename == NULL || strlen(filename) == 0)
return PM3_EMALLOC;
int res = searchFinalFile(foundpath, pm3dir, filename, silent);
if (res != PM3_SUCCESS) {
if ((res == PM3_EFILE) && (!silent))