aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2021-07-15 16:18:17 +0000
committerMark Johnston <markj@FreeBSD.org>2021-07-29 12:11:16 +0000
commitf9d3c6f4b5d1a2a35b05a52bf598ebfca21d3322 (patch)
treee0ab76ef277c9c8cd9a29d55637aca7a6e61ff87 /sys
parente504e98ab5e6a3155054a98660a244075609db0b (diff)
downloadsrc-f9d3c6f4b5d1a2a35b05a52bf598ebfca21d3322.tar.gz
src-f9d3c6f4b5d1a2a35b05a52bf598ebfca21d3322.zip
nfsclient: Avoid copying uninitialized bytes into statfs
hst will be nul-terminated but the remaining space in the buffer is left uninitialized. Avoid copying the entire buffer to ensure that uninitialized bytes are not leaked via statfs(2). Reported by: KMSAN Reviewed by: rmacklem Sponsored by: The FreeBSD Foundation (cherry picked from commit 44de1834b53f4654cc2f6d76406f5705f8167927)
Diffstat (limited to 'sys')
-rw-r--r--sys/fs/nfsclient/nfs_clvfsops.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/fs/nfsclient/nfs_clvfsops.c b/sys/fs/nfsclient/nfs_clvfsops.c
index 974bc684bf5b..2fe30035b904 100644
--- a/sys/fs/nfsclient/nfs_clvfsops.c
+++ b/sys/fs/nfsclient/nfs_clvfsops.c
@@ -1562,7 +1562,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam,
nmp->nm_fhsize = argp->fhsize;
if (nmp->nm_fhsize > 0)
bcopy((caddr_t)argp->fh, (caddr_t)nmp->nm_fh, argp->fhsize);
- bcopy(hst, mp->mnt_stat.f_mntfromname, MNAMELEN);
+ strlcpy(mp->mnt_stat.f_mntfromname, hst, MNAMELEN);
nmp->nm_nam = nam;
/* Set up the sockets and per-host congestion */
nmp->nm_sotype = argp->sotype;