Source-Changes-HG archive

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

[src/trunk]: src/sys/compat Fix info leaks in sysinfo().



details:   https://anonhg.NetBSD.org/src/rev/c90b580ae24a
branches:  trunk
changeset: 453702:c90b580ae24a
user:      maxv <maxv%NetBSD.org@localhost>
date:      Fri Aug 23 08:01:42 2019 +0000

description:
Fix info leaks in sysinfo().

diffstat:

 sys/compat/linux/common/linux_misc.c        |  5 +++--
 sys/compat/linux32/common/linux32_sysinfo.c |  5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diffs (52 lines):

diff -r c9828372e7c4 -r c90b580ae24a sys/compat/linux/common/linux_misc.c
--- a/sys/compat/linux/common/linux_misc.c      Fri Aug 23 07:53:36 2019 +0000
+++ b/sys/compat/linux/common/linux_misc.c      Fri Aug 23 08:01:42 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_misc.c,v 1.242 2019/08/23 07:53:36 maxv Exp $    */
+/*     $NetBSD: linux_misc.c,v 1.243 2019/08/23 08:01:42 maxv Exp $    */
 
 /*-
  * Copyright (c) 1995, 1998, 1999, 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.242 2019/08/23 07:53:36 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.243 2019/08/23 08:01:42 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1347,6 +1347,7 @@
        struct linux_sysinfo si;
        struct loadavg *la;
 
+       memset(&si, 0, sizeof(si));
        si.uptime = time_uptime;
        la = &averunnable;
        si.loads[0] = la->ldavg[0] * LINUX_SYSINFO_LOADS_SCALE / la->fscale;
diff -r c9828372e7c4 -r c90b580ae24a sys/compat/linux32/common/linux32_sysinfo.c
--- a/sys/compat/linux32/common/linux32_sysinfo.c       Fri Aug 23 07:53:36 2019 +0000
+++ b/sys/compat/linux32/common/linux32_sysinfo.c       Fri Aug 23 08:01:42 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux32_sysinfo.c,v 1.7 2008/11/19 18:36:04 ad Exp $ */
+/*     $NetBSD: linux32_sysinfo.c,v 1.8 2019/08/23 08:01:43 maxv Exp $ */
 
 /*-
  * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
@@ -33,7 +33,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: linux32_sysinfo.c,v 1.7 2008/11/19 18:36:04 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_sysinfo.c,v 1.8 2019/08/23 08:01:43 maxv Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -70,6 +70,7 @@
        struct linux32_sysinfo si;
        struct loadavg *la;
 
+       memset(&si, 0, sizeof(si));
        si.uptime = time_uptime;
        la = &averunnable;
        si.loads[0] = la->ldavg[0] * LINUX_SYSINFO_LOADS_SCALE / la->fscale;



Home | Main Index | Thread Index | Old Index