Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Zero out the ntptimeval structure to prevent a 4 by...



details:   https://anonhg.NetBSD.org/src/rev/1fe06653e6ce
branches:  trunk
changeset: 836660:1fe06653e6ce
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Oct 29 22:02:25 2018 +0000

description:
Zero out the ntptimeval structure to prevent a 4 byte kernel stack disclosure.
Reported by Thomas Barabosch.

diffstat:

 sys/kern/kern_ntptime.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r 5db1bbe8937a -r 1fe06653e6ce sys/kern/kern_ntptime.c
--- a/sys/kern/kern_ntptime.c   Mon Oct 29 21:06:13 2018 +0000
+++ b/sys/kern/kern_ntptime.c   Mon Oct 29 22:02:25 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_ntptime.c,v 1.59 2018/07/01 15:12:06 riastradh Exp $      */
+/*     $NetBSD: kern_ntptime.c,v 1.60 2018/10/29 22:02:25 christos Exp $       */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
 
 #include <sys/cdefs.h>
 /* __FBSDID("$FreeBSD: src/sys/kern/kern_ntptime.c,v 1.59 2005/05/28 14:34:41 rwatson Exp $"); */
-__KERNEL_RCSID(0, "$NetBSD: kern_ntptime.c,v 1.59 2018/07/01 15:12:06 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_ntptime.c,v 1.60 2018/10/29 22:02:25 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ntp.h"
@@ -239,6 +239,7 @@
 void
 ntp_gettime(struct ntptimeval *ntv)
 {
+       memset(ntv, 0, sizeof(*ntv));
 
        mutex_spin_enter(&timecounter_lock);
        nanotime(&ntv->time);



Home | Main Index | Thread Index | Old Index