diff --git a/nx/source/runtime/devices/fs_dev.c b/nx/source/runtime/devices/fs_dev.c index a5883def..13c37ed8 100644 --- a/nx/source/runtime/devices/fs_dev.c +++ b/nx/source/runtime/devices/fs_dev.c @@ -199,7 +199,7 @@ fsdev_fixpath(struct _reent *r, strncpy(__fixedpath, path, PATH_MAX); else { - strncpy(__fixedpath, __cwd, PATH_MAX); + strcpy(__fixedpath, __cwd); strncat(__fixedpath, path, PATH_MAX - strlen(__cwd)); } @@ -242,7 +242,8 @@ fsdev_getfspath(struct _reent *r, return -1; memset(outpath, 0, FS_MAX_PATH); - strncpy(outpath, __fixedpath, FS_MAX_PATH); + memcpy(outpath, __fixedpath,FS_MAX_PATH); + outpath[FS_MAX_PATH-1] = '\0'; return 0; } @@ -1038,7 +1039,7 @@ fsdev_chdir(struct _reent *r, if(R_SUCCEEDED(rc)) { fsDirClose(&fd); - strncpy(__cwd, __fixedpath, PATH_MAX); + strcpy(__cwd, __fixedpath); fsdev_fsdevice_cwd = device->id; return 0; } diff --git a/nx/source/services/fsldr.c b/nx/source/services/fsldr.c index a62b73bb..5e978f6a 100644 --- a/nx/source/services/fsldr.c +++ b/nx/source/services/fsldr.c @@ -36,7 +36,7 @@ void fsldrExit(void) { } Result fsldrOpenCodeFileSystem(u64 tid, const char *path, FsFileSystem* out) { - char send_path[FS_MAX_PATH] = {0}; + char send_path[FS_MAX_PATH+1] = {0}; IpcCommand c; ipcInitialize(&c); ipcAddSendStatic(&c, send_path, FS_MAX_PATH, 0); diff --git a/nx/source/services/lr.c b/nx/source/services/lr.c index 5fd49d97..d1499b7d 100644 --- a/nx/source/services/lr.c +++ b/nx/source/services/lr.c @@ -144,7 +144,7 @@ static Result _lrResolvePath(Service* s, u64 cmd_id, u64 tid, char *out) { This is a helper function to perform the work for those funcs, given a command ID. */ static Result _lrRedirectPath(Service* s, u64 cmd_id, u64 tid, const char *path) { - char send_path[FS_MAX_PATH] = {0}; + char send_path[FS_MAX_PATH+1] = {0}; IpcCommand c; ipcInitialize(&c); ipcAddSendStatic(&c, send_path, FS_MAX_PATH, 0);