Skip to content
/ linux Public
forked from torvalds/linux

Commit

Permalink
NFSD: Cap the number of bytes copied by nfs4_reset_recoverydir()
Browse files Browse the repository at this point in the history
[ Upstream commit f64ea4a ]

It's only current caller already length-checks the string, but let's
be safe.

Fixes: 0964a3d ("[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>
  • Loading branch information
chucklever authored and gregkh committed Dec 6, 2024
1 parent 0492e98 commit 6dcb1b1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/nfsd/nfs4recover.c
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,8 @@ nfs4_reset_recoverydir(char *recdir)
return status;
status = -ENOTDIR;
if (d_is_dir(path.dentry)) {
strcpy(user_recovery_dirname, recdir);
strscpy(user_recovery_dirname, recdir,
sizeof(user_recovery_dirname));
status = 0;
}
path_put(&path);
Expand Down

0 comments on commit 6dcb1b1

Please sign in to comment.