diff options
author | pjd <pjd@FreeBSD.org> | 2005-05-22 23:05:27 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2005-05-22 23:05:27 +0000 |
commit | 0b89469bda3bdf3b47599e8e3be3ce8b08c574e1 (patch) | |
tree | da293fa2e1180db8e7dcb7336c8bb6a3e0697c4b | |
parent | abf228987206d99eefbf00bd06d5097259a4604a (diff) | |
download | FreeBSD-src-0b89469bda3bdf3b47599e8e3be3ce8b08c574e1.zip FreeBSD-src-0b89469bda3bdf3b47599e8e3be3ce8b08c574e1.tar.gz |
Protect fsid in freebsd4_getfsstat() in simlar way as it is done in
getfsstat().
-rw-r--r-- | sys/kern/vfs_extattr.c | 9 | ||||
-rw-r--r-- | sys/kern/vfs_syscalls.c | 9 |
2 files changed, 12 insertions, 6 deletions
diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c index 3e8c968..ed4505a 100644 --- a/sys/kern/vfs_extattr.c +++ b/sys/kern/vfs_extattr.c @@ -516,7 +516,7 @@ freebsd4_getfsstat(td, uap) } */ *uap; { struct mount *mp, *nmp; - struct statfs *sp; + struct statfs *sp, sb; struct ostatfs osb; caddr_t sfsp; long count, maxcount, error; @@ -556,9 +556,12 @@ freebsd4_getfsstat(td, uap) continue; } sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; + if (suser(td)) { + bcopy(sp, &sb, sizeof(sb)); + sb.f_fsid.val[0] = sb.f_fsid.val[1] = 0; + sp = &sb; + } cvtstatfs(td, sp, &osb); - if (suser(td)) - osb.f_fsid.val[0] = osb.f_fsid.val[1] = 0; error = copyout(&osb, sfsp, sizeof(osb)); if (error) { vfs_unbusy(mp, td); diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 3e8c968..ed4505a 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -516,7 +516,7 @@ freebsd4_getfsstat(td, uap) } */ *uap; { struct mount *mp, *nmp; - struct statfs *sp; + struct statfs *sp, sb; struct ostatfs osb; caddr_t sfsp; long count, maxcount, error; @@ -556,9 +556,12 @@ freebsd4_getfsstat(td, uap) continue; } sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; + if (suser(td)) { + bcopy(sp, &sb, sizeof(sb)); + sb.f_fsid.val[0] = sb.f_fsid.val[1] = 0; + sp = &sb; + } cvtstatfs(td, sp, &osb); - if (suser(td)) - osb.f_fsid.val[0] = osb.f_fsid.val[1] = 0; error = copyout(&osb, sfsp, sizeof(osb)); if (error) { vfs_unbusy(mp, td); |