From 83201e26d4d23a5820fad729af13791adb0207ae Mon Sep 17 00:00:00 2001 From: deraadt Date: Wed, 5 Apr 2017 03:59:13 +0000 Subject: [PATCH] clear structure on the stack before copying out for sysctl. At present it has no pads, but a future ABI change could add something and leak kernel memory. --- sys/kern/kern_clock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c index 106e41a5a31..310260a3b8c 100644 --- a/sys/kern/kern_clock.c +++ b/sys/kern/kern_clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_clock.c,v 1.91 2016/09/04 09:22:29 mpi Exp $ */ +/* $OpenBSD: kern_clock.c,v 1.92 2017/04/05 03:59:13 deraadt Exp $ */ /* $NetBSD: kern_clock.c,v 1.34 1996/06/09 04:51:03 briggs Exp $ */ /*- @@ -424,6 +424,7 @@ sysctl_clockrate(char *where, size_t *sizep, void *newp) /* * Construct clockinfo structure. */ + memset(&clkinfo, 0, sizeof clkinfo); clkinfo.tick = tick; clkinfo.tickadj = tickadj; clkinfo.hz = hz; -- 2.20.1