Skip to content

Commit f063b03

Browse files
chucklevergregkh
authored andcommitted
NFSD: Cap the number of bytes copied by nfs4_reset_recoverydir()
[ 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 <[email protected]> Signed-off-by: Chuck Lever <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 4a4ffc1 commit f063b03

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/nfsd/nfs4recover.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,8 @@ nfs4_reset_recoverydir(char *recdir)
659659
return status;
660660
status = -ENOTDIR;
661661
if (d_is_dir(path.dentry)) {
662-
strcpy(user_recovery_dirname, recdir);
662+
strscpy(user_recovery_dirname, recdir,
663+
sizeof(user_recovery_dirname));
663664
status = 0;
664665
}
665666
path_put(&path);

0 commit comments

Comments
 (0)