Skip to content

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 f64ea4af43161bb86ffc77e6aeb5bcf5c3229df0 ]

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]>
(cherry picked from commit 6dcb1b1322f3277dc213309d9f4bf6d6c265115a)
  • Loading branch information
chucklever authored and opsiff committed Dec 7, 2024
1 parent cf890d8 commit 63dd372
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 63dd372

Please sign in to comment.