From a6894024dd4049997352d03d3e3669b6c1b593b0 Mon Sep 17 00:00:00 2001 From: jdolecek Date: Mon, 13 Sep 2004 20:02:20 +0000 Subject: [PATCH] dostatvfs(): zero the statvfs structure before calling filesystem code, so that unset parts would have defined value and not pass random parts of kernel stack --- sys/kern/vfs_syscalls.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 27d660196556..e274ae0cd051 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_syscalls.c,v 1.210 2004/07/01 10:03:30 hannken Exp $ */ +/* $NetBSD: vfs_syscalls.c,v 1.211 2004/09/13 20:02:20 jdolecek Exp $ */ /* * Copyright (c) 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.210 2004/07/01 10:03:30 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.211 2004/09/13 20:02:20 jdolecek Exp $"); #include "opt_compat_netbsd.h" #include "opt_compat_43.h" @@ -692,6 +692,8 @@ dostatvfs(struct mount *mp, struct statvfs *sp, struct proc *p, int flags, goto done; } + /* Get the filesystem stats now */ + memset(sp, 0, sizeof(*sp)); if ((error = VFS_STATVFS(mp, sp, p)) != 0) { return error; }