summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2009-06-08 00:52:24 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2009-06-08 00:52:24 +0000
commitbdeb1820922fb83905f115ec96e0e08268a7d7e0 (patch)
treee232a99c0984d34c90aa89da2d57982e9ff2d859
parent2a1aa8c953716703ff203fa59e61bccab2fcf54d (diff)
some vnodes have a NULL mountpoint, so strlcpy of the f_mntonname if not advised
-rw-r--r--sys/kern/kern_sysctl.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index 4496273eca2..d7a6e82b2dc 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sysctl.c,v 1.172 2009/06/07 03:07:19 millert Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.173 2009/06/08 00:52:23 deraadt Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@@ -1073,8 +1073,10 @@ fill_file2(struct kinfo_file2 *kf, struct file *fp, struct filedesc *fdp,
kf->v_flag = vp->v_flag;
kf->v_data = PTRTOINT64(vp->v_data);
kf->v_mount = PTRTOINT64(vp->v_mount);
- strlcpy(kf->f_mntonname, vp->v_mount->mnt_stat.f_mntonname,
- sizeof(kf->f_mntonname));
+ if (vp->v_mount)
+ strlcpy(kf->f_mntonname,
+ vp->v_mount->mnt_stat.f_mntonname,
+ sizeof(kf->f_mntonname));
if (VOP_GETATTR(vp, &va, p->p_ucred, p) == 0) {
kf->va_fileid = va.va_fileid;