use strlcpy in cvtstatfs and copy_statfs instead of bcopy to ensure
the copied strings are properly terminated. bzero the statfs32 struct in copy_statfs.
This commit is contained in:
parent
c402cadc1c
commit
6308f39da8
@ -131,6 +131,8 @@ freebsd32_wait4(struct thread *td, struct freebsd32_wait4_args *uap)
|
||||
static void
|
||||
copy_statfs(struct statfs *in, struct statfs32 *out)
|
||||
{
|
||||
|
||||
bzero(out, sizeof(*out));
|
||||
CP(*in, *out, f_bsize);
|
||||
CP(*in, *out, f_iosize);
|
||||
CP(*in, *out, f_blocks);
|
||||
@ -145,14 +147,14 @@ copy_statfs(struct statfs *in, struct statfs32 *out)
|
||||
CP(*in, *out, f_flags);
|
||||
CP(*in, *out, f_syncwrites);
|
||||
CP(*in, *out, f_asyncwrites);
|
||||
bcopy(in->f_fstypename,
|
||||
out->f_fstypename, MFSNAMELEN);
|
||||
bcopy(in->f_mntonname,
|
||||
out->f_mntonname, min(MNAMELEN, FREEBSD4_MNAMELEN));
|
||||
strlcpy(out->f_fstypename,
|
||||
in->f_fstypename, MFSNAMELEN);
|
||||
strlcpy(out->f_mntonname,
|
||||
in->f_mntonname, min(MNAMELEN, FREEBSD4_MNAMELEN));
|
||||
CP(*in, *out, f_syncreads);
|
||||
CP(*in, *out, f_asyncreads);
|
||||
bcopy(in->f_mntfromname,
|
||||
out->f_mntfromname, min(MNAMELEN, FREEBSD4_MNAMELEN));
|
||||
strlcpy(out->f_mntfromname,
|
||||
in->f_mntfromname, min(MNAMELEN, FREEBSD4_MNAMELEN));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -663,11 +663,11 @@ cvtstatfs(nsp, osp)
|
||||
osp->f_asyncwrites = MIN(nsp->f_asyncwrites, LONG_MAX);
|
||||
osp->f_syncreads = MIN(nsp->f_syncreads, LONG_MAX);
|
||||
osp->f_asyncreads = MIN(nsp->f_asyncreads, LONG_MAX);
|
||||
bcopy(nsp->f_fstypename, osp->f_fstypename,
|
||||
MIN(MFSNAMELEN, OMNAMELEN));
|
||||
bcopy(nsp->f_mntonname, osp->f_mntonname,
|
||||
strlcpy(osp->f_fstypename, nsp->f_fstypename,
|
||||
MIN(MFSNAMELEN, OMFSNAMELEN));
|
||||
strlcpy(osp->f_mntonname, nsp->f_mntonname,
|
||||
MIN(MNAMELEN, OMNAMELEN));
|
||||
bcopy(nsp->f_mntfromname, osp->f_mntfromname,
|
||||
strlcpy(osp->f_mntfromname, nsp->f_mntfromname,
|
||||
MIN(MNAMELEN, OMNAMELEN));
|
||||
osp->f_fsid = nsp->f_fsid;
|
||||
}
|
||||
|
@ -663,11 +663,11 @@ cvtstatfs(nsp, osp)
|
||||
osp->f_asyncwrites = MIN(nsp->f_asyncwrites, LONG_MAX);
|
||||
osp->f_syncreads = MIN(nsp->f_syncreads, LONG_MAX);
|
||||
osp->f_asyncreads = MIN(nsp->f_asyncreads, LONG_MAX);
|
||||
bcopy(nsp->f_fstypename, osp->f_fstypename,
|
||||
MIN(MFSNAMELEN, OMNAMELEN));
|
||||
bcopy(nsp->f_mntonname, osp->f_mntonname,
|
||||
strlcpy(osp->f_fstypename, nsp->f_fstypename,
|
||||
MIN(MFSNAMELEN, OMFSNAMELEN));
|
||||
strlcpy(osp->f_mntonname, nsp->f_mntonname,
|
||||
MIN(MNAMELEN, OMNAMELEN));
|
||||
bcopy(nsp->f_mntfromname, osp->f_mntfromname,
|
||||
strlcpy(osp->f_mntfromname, nsp->f_mntfromname,
|
||||
MIN(MNAMELEN, OMNAMELEN));
|
||||
osp->f_fsid = nsp->f_fsid;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user