Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/wscons wsevent_copyout_events50 - don't leak garbage...
details: https://anonhg.NetBSD.org/src/rev/e7d6b2979ab2
branches: trunk
changeset: 319824:e7d6b2979ab2
user: uwe <uwe%NetBSD.org@localhost>
date: Wed Jun 13 02:09:09 2018 +0000
description:
wsevent_copyout_events50 - don't leak garbage from the kernel stack.
On 64-bit machines struct timespec50 has padding between 32-bit tv_sec
and long tv_nsec that is not affected by normal assignment. Scrub it
before we uiomove struct owscons_event.
diffstat:
sys/dev/wscons/wsevent.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diffs (28 lines):
diff -r b54be3497aad -r e7d6b2979ab2 sys/dev/wscons/wsevent.c
--- a/sys/dev/wscons/wsevent.c Wed Jun 13 00:24:07 2018 +0000
+++ b/sys/dev/wscons/wsevent.c Wed Jun 13 02:09:09 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wsevent.c,v 1.37 2017/10/25 08:12:39 maya Exp $ */
+/* $NetBSD: wsevent.c,v 1.38 2018/06/13 02:09:09 uwe Exp $ */
/*-
* Copyright (c) 2006, 2008 The NetBSD Foundation, Inc.
@@ -104,7 +104,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsevent.c,v 1.37 2017/10/25 08:12:39 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsevent.c,v 1.38 2018/06/13 02:09:09 uwe Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -202,6 +202,9 @@
ev50.type = ev->type;
ev50.value = ev->value;
+#if INT32_MAX < LONG_MAX /* scrub padding */
+ memset(&ev50.time, 0, offsetof(struct timespec50, tv_nsec));
+#endif
timespec_to_timespec50(&ev->time, &ev50.time);
error = uiomove(&ev50, sizeof(ev50), uio);
Home |
Main Index |
Thread Index |
Old Index