NFSD: Cap the number of bytes copied by nfs4_reset_recoverydir()
[ Upstream commit f64ea4af43161bb86ffc77e6aeb5bcf5c3229df0 ] It's only current caller already length-checks the string, but let's be safe. Fixes: 0964a3d3f1aa ("[PATCH] knfsd: nfsd4 reboot dirname fix") Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
8589fc2e30
commit
672c09ab1f
1 changed files with 2 additions and 1 deletions
|
@ -658,7 +658,8 @@ nfs4_reset_recoverydir(char *recdir)
|
||||||
return status;
|
return status;
|
||||||
status = -ENOTDIR;
|
status = -ENOTDIR;
|
||||||
if (d_is_dir(path.dentry)) {
|
if (d_is_dir(path.dentry)) {
|
||||||
strcpy(user_recovery_dirname, recdir);
|
strscpy(user_recovery_dirname, recdir,
|
||||||
|
sizeof(user_recovery_dirname));
|
||||||
status = 0;
|
status = 0;
|
||||||
}
|
}
|
||||||
path_put(&path);
|
path_put(&path);
|
||||||
|
|
Loading…
Reference in a new issue