fix warning by terminating string instead

This commit is contained in:
Dave Murphy 2018-05-08 18:33:47 +01:00
parent 8fb22120bd
commit 0865c8c9b0

View File

@ -199,7 +199,7 @@ fsdev_fixpath(struct _reent *r,
strncpy(__fixedpath, path, PATH_MAX); strncpy(__fixedpath, path, PATH_MAX);
else else
{ {
strcpy(__fixedpath, __cwd); strncpy(__fixedpath, __cwd, PATH_MAX); __fixedpath[PATH_MAX] = 0;
strncat(__fixedpath, path, PATH_MAX - strlen(__cwd)); strncat(__fixedpath, path, PATH_MAX - strlen(__cwd));
} }
@ -1039,7 +1039,7 @@ fsdev_chdir(struct _reent *r,
if(R_SUCCEEDED(rc)) if(R_SUCCEEDED(rc))
{ {
fsDirClose(&fd); fsDirClose(&fd);
strcpy(__cwd, __fixedpath); strncpy(__cwd, __fixedpath, PATH_MAX);__cwd[PATH_MAX] = 0;
fsdev_fsdevice_cwd = device->id; fsdev_fsdevice_cwd = device->id;
return 0; return 0;
} }