Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/compat/linux/common Make sure to never leak padding spac...
details: https://anonhg.NetBSD.org/src/rev/0b0eebf44cc2
branches: trunk
changeset: 749072:0b0eebf44cc2
user: joerg <joerg%NetBSD.org@localhost>
date: Mon Nov 16 08:44:19 2009 +0000
description:
Make sure to never leak padding space before copyout or copyin
uninitialized fields by explicitly using memset in the conversion
routines.
diffstat:
sys/compat/linux/common/linux_ipc.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diffs (52 lines):
diff -r 4b75121263db -r 0b0eebf44cc2 sys/compat/linux/common/linux_ipc.c
--- a/sys/compat/linux/common/linux_ipc.c Mon Nov 16 07:45:50 2009 +0000
+++ b/sys/compat/linux/common/linux_ipc.c Mon Nov 16 08:44:19 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_ipc.c,v 1.53 2009/04/23 17:40:57 njoly Exp $ */
+/* $NetBSD: linux_ipc.c,v 1.54 2009/11/16 08:44:19 joerg Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_ipc.c,v 1.53 2009/04/23 17:40:57 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_ipc.c,v 1.54 2009/11/16 08:44:19 joerg Exp $");
#if defined(_KERNEL_OPT)
#include "opt_sysv.h"
@@ -306,6 +306,7 @@
linux_to_bsd_msqid_ds(struct linux_msqid_ds *lmp, struct msqid_ds *bmp)
{
+ memset(bmp, 0, sizeof(*bmp));
linux_to_bsd_ipc_perm(&lmp->l_msg_perm, &bmp->msg_perm);
bmp->_msg_first = lmp->l_msg_first;
bmp->_msg_last = lmp->l_msg_last;
@@ -322,6 +323,8 @@
void
linux_to_bsd_msqid64_ds(struct linux_msqid64_ds *lmp, struct msqid_ds *bmp)
{
+
+ memset(bmp, 0, sizeof(*bmp));
linux_to_bsd_ipc64_perm(&lmp->l_msg_perm, &bmp->msg_perm);
bmp->msg_stime = lmp->l_msg_stime;
bmp->msg_rtime = lmp->l_msg_rtime;
@@ -337,6 +340,7 @@
bsd_to_linux_msqid_ds(struct msqid_ds *bmp, struct linux_msqid_ds *lmp)
{
+ memset(lmp, 0, sizeof(*lmp));
bsd_to_linux_ipc_perm(&bmp->msg_perm, &lmp->l_msg_perm);
lmp->l_msg_first = bmp->_msg_first;
lmp->l_msg_last = bmp->_msg_last;
@@ -353,6 +357,8 @@
void
bsd_to_linux_msqid64_ds(struct msqid_ds *bmp, struct linux_msqid64_ds *lmp)
{
+
+ memset(lmp, 0, sizeof(*lmp));
bsd_to_linux_ipc64_perm(&bmp->msg_perm, &lmp->l_msg_perm);
lmp->l_msg_stime = bmp->msg_stime;
lmp->l_msg_rtime = bmp->msg_rtime;
Home |
Main Index |
Thread Index |
Old Index