summaryrefslogtreecommitdiff
path: root/sys/compat/common/vfs_syscalls_20.c
diff options
context:
space:
mode:
authormartin <martin@NetBSD.org>2022-08-03 11:16:12 +0000
committermartin <martin@NetBSD.org>2022-08-03 11:16:12 +0000
commit947be38c1e42b83766b21aaad29fdaf7a595dc63 (patch)
treecc4cf69c3032dcb1ea481140919ae3470d5b4554 /sys/compat/common/vfs_syscalls_20.c
parentc0cbb295300c06ff7945a8867c3b48a4e30dcb6c (diff)
Apply patch, requested by riastradh in ticket #1487:
sys/compat/common/vfs_syscalls_20.c (apply patch) sys/compat: Memset zero before copyout. Just in case of uninitialized padding which would lead to kernel stack disclosure. If the compiler can prove the memset redundant then it can optimize it away; otherwise better safe than sorry.
Diffstat (limited to 'sys/compat/common/vfs_syscalls_20.c')
-rw-r--r--sys/compat/common/vfs_syscalls_20.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/compat/common/vfs_syscalls_20.c b/sys/compat/common/vfs_syscalls_20.c
index 14aafb4cdb0..941c4ddade3 100644
--- a/sys/compat/common/vfs_syscalls_20.c
+++ b/sys/compat/common/vfs_syscalls_20.c
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_syscalls_20.c,v 1.41 2019/01/27 02:08:39 pgoyette Exp $ */
+/* $NetBSD: vfs_syscalls_20.c,v 1.41.4.1 2022/08/03 11:16:12 martin Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_20.c,v 1.41 2019/01/27 02:08:39 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_20.c,v 1.41.4.1 2022/08/03 11:16:12 martin Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -103,6 +103,9 @@ vfs2fs(struct statfs12 *bfs, const struct statvfs *fs)
{
struct statfs12 ofs;
int i;
+
+ memset(&ofs, 0, sizeof(ofs));
+
ofs.f_type = 0;
ofs.f_oflags = (short)fs->f_flag;