Module Name:    src
Committed By:   maxv
Date:           Wed Jul 10 17:32:38 UTC 2019

Modified Files:
        src/sys/kern: subr_cprng.c

Log Message:
Zero out 'cprng->cs_name' entirely. Otherwise the RND pool gets polluted
by uninitialized bits from the end of the string.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/kern/subr_cprng.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/subr_cprng.c
diff -u src/sys/kern/subr_cprng.c:1.29 src/sys/kern/subr_cprng.c:1.30
--- src/sys/kern/subr_cprng.c:1.29	Fri Dec  1 19:05:49 2017
+++ src/sys/kern/subr_cprng.c	Wed Jul 10 17:32:37 2019
@@ -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 @@ cprng_strong_create(const char *name, in
 	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);

Reply via email to