PATH_MAX is max length of fixedpath string

This commit is contained in:
Dave Murphy 2017-05-04 21:33:53 +01:00
parent 1ed97e8ba2
commit e43d368fbc

View File

@ -146,11 +146,11 @@ sdmc_fixpath(struct _reent *r,
} while(code != 0); } while(code != 0);
if(path[0] == '/') if(path[0] == '/')
strncpy(__fixedpath, path, PATH_MAX+1); strncpy(__fixedpath, path, PATH_MAX);
else else
{ {
strncpy(__fixedpath, __cwd, PATH_MAX+1); strncpy(__fixedpath, __cwd, PATH_MAX);
strncat(__fixedpath, path, PATH_MAX+1); strncat(__fixedpath, path, PATH_MAX);
} }
if(__fixedpath[PATH_MAX] != 0) if(__fixedpath[PATH_MAX] != 0)