From e526d8a15118b2469b711c61441407c5fd2b3ba0 Mon Sep 17 00:00:00 2001 From: guenther Date: Wed, 5 Apr 2017 04:15:44 +0000 Subject: [PATCH] timeval has trailing padding on powerpc and m88k, so memset it before copyout to avoid leaking kernel stack ok deraadt@ --- sys/kern/kern_sysctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index cb38823cfd0..d08767d14bc 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sysctl.c,v 1.323 2017/04/05 04:00:41 deraadt Exp $ */ +/* $OpenBSD: kern_sysctl.c,v 1.324 2017/04/05 04:15:44 guenther Exp $ */ /* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */ /*- @@ -370,6 +370,7 @@ kern_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, return (sysctl_clockrate(oldp, oldlenp, newp)); case KERN_BOOTTIME: { struct timeval bt; + memset(&bt, 0, sizeof bt); TIMESPEC_TO_TIMEVAL(&bt, &boottime); return (sysctl_rdstruct(oldp, oldlenp, newp, &bt, sizeof bt)); } -- 2.20.1