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 'cprng->cs_name' entirely. Otherwise the R...
details: https://anonhg.NetBSD.org/src/rev/16da3977439f
branches: trunk
changeset: 457656:16da3977439f
user: maxv <maxv%NetBSD.org@localhost>
date: Wed Jul 10 17:32:37 2019 +0000
description:
Zero out 'cprng->cs_name' entirely. Otherwise the RND pool gets polluted
by uninitialized bits from the end of the string.
diffstat:
sys/kern/subr_cprng.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diffs (26 lines):
diff -r fbe12784fa63 -r 16da3977439f sys/kern/subr_cprng.c
--- a/sys/kern/subr_cprng.c Wed Jul 10 16:35:11 2019 +0000
+++ b/sys/kern/subr_cprng.c Wed Jul 10 17:32:37 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_cprng.c,v 1.29 2017/12/01 19:05:49 christos Exp $ */
+/* $NetBSD: subr_cprng.c,v 1.30 2019/07/10 17:32:37 maxv Exp $ */
/*-
* Copyright (c) 2011-2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_cprng.c,v 1.29 2017/12/01 19:05:49 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_cprng.c,v 1.30 2019/07/10 17:32:37 maxv Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -140,6 +140,7 @@
KASSERT(ipl != IPL_SCHED && ipl != IPL_HIGH);
/* Initialize the easy fields. */
+ memset(cprng->cs_name, 0, sizeof(cprng->cs_name));
(void)strlcpy(cprng->cs_name, name, sizeof(cprng->cs_name));
cprng->cs_flags = flags;
mutex_init(&cprng->cs_lock, MUTEX_DEFAULT, ipl);
Home |
Main Index |
Thread Index |
Old Index