Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Clear out the struct kinfo_drivers before stuffing ...



details:   https://anonhg.NetBSD.org/src/rev/17d95b766693
branches:  trunk
changeset: 565421:17d95b766693
user:      atatat <atatat%NetBSD.org@localhost>
date:      Thu Apr 08 03:35:10 2004 +0000

description:
Clear out the struct kinfo_drivers before stuffing things into it.
Avoids leaking garbage from the stack (left over from the earlier
call to sysctl_locate()).

diffstat:

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

diffs (26 lines):

diff -r beec38110fbc -r 17d95b766693 sys/kern/init_sysctl.c
--- a/sys/kern/init_sysctl.c    Thu Apr 08 01:35:33 2004 +0000
+++ b/sys/kern/init_sysctl.c    Thu Apr 08 03:35:10 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: init_sysctl.c,v 1.24 2004/03/24 15:34:52 atatat Exp $ */
+/*     $NetBSD: init_sysctl.c,v 1.25 2004/04/08 03:35:10 atatat Exp $ */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: init_sysctl.c,v 1.24 2004/03/24 15:34:52 atatat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_sysctl.c,v 1.25 2004/04/08 03:35:10 atatat Exp $");
 
 #include "opt_sysv.h"
 #include "opt_multiprocessor.h"
@@ -1696,6 +1696,7 @@
                        error = ENOMEM;
                        break;
                }
+               memset(&kd, 0, sizeof(kd));
                kd.d_bmajor = devsw_conv[i].d_bmajor;
                kd.d_cmajor = devsw_conv[i].d_cmajor;
                strlcpy(kd.d_name, dname, sizeof kd.d_name);



Home | Main Index | Thread Index | Old Index