Skip to content

Commit f64ea4a

Browse files
committed
NFSD: Cap the number of bytes copied by nfs4_reset_recoverydir()
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>
1 parent 30c1d24 commit f64ea4a

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

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)