Source-Changes-HG archive

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

[src/netbsd-9]: src/sys/kern Pull up following revision(s) (requested by nia ...



details:   https://anonhg.NetBSD.org/src/rev/b6204128ee9e
branches:  netbsd-9
changeset: 963894:b6204128ee9e
user:      martin <martin%NetBSD.org@localhost>
date:      Mon May 18 18:57:31 2020 +0000

description:
Pull up following revision(s) (requested by nia in ticket #914):

        sys/kern/subr_cprng.c: revision 1.37 (via patch, adapted)

Make kern.arandom truncate the output instead of failing with ETOOBIG
when the requested data exceeds 256 bytes in size. The actual size of
the returned data is output to oldlenp.

This matches FreeBSD's behaviour and seems to be more in line with
what software in the wild expects.

"sounds reasonble" - Riastradh

diffstat:

 sys/kern/subr_cprng.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r cd3ae6a90c20 -r b6204128ee9e sys/kern/subr_cprng.c
--- a/sys/kern/subr_cprng.c     Mon May 18 18:54:30 2020 +0000
+++ b/sys/kern/subr_cprng.c     Mon May 18 18:57:31 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_cprng.c,v 1.30.2.3 2020/04/30 15:34:06 martin Exp $ */
+/*     $NetBSD: subr_cprng.c,v 1.30.2.4 2020/05/18 18:57:31 martin 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.30.2.3 2020/04/30 15:34:06 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_cprng.c,v 1.30.2.4 2020/05/18 18:57:31 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -551,7 +551,7 @@
                return 0;
            default:
                if (*oldlenp > 256) {
-                       return E2BIG;
+                       *oldlenp = 256;
                }
                RUN_ONCE(&sysctl_prng_once, makeprng);
                v = kmem_alloc(*oldlenp, KM_SLEEP);



Home | Main Index | Thread Index | Old Index