diff options
author | ps <ps@FreeBSD.org> | 2006-03-04 00:09:09 +0000 |
---|---|---|
committer | ps <ps@FreeBSD.org> | 2006-03-04 00:09:09 +0000 |
commit | 2399d185fc6ba76a6630ecae4436a11772a3973e (patch) | |
tree | a1562c2dcd0ae19dae3516a7d4afb9a88292ab83 /sys/compat | |
parent | 869493f015eb038ab04f7c10a09d1423d7c38d0e (diff) | |
download | FreeBSD-src-2399d185fc6ba76a6630ecae4436a11772a3973e.zip FreeBSD-src-2399d185fc6ba76a6630ecae4436a11772a3973e.tar.gz |
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.
Diffstat (limited to 'sys/compat')
-rw-r--r-- | sys/compat/freebsd32/freebsd32_misc.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index cb05ceb..1045d12 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -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 |