Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/sunxi Truncate hw.sun8icryptoN.rng queries to 4...



details:   https://anonhg.NetBSD.org/src/rev/8cbe4aa17351
branches:  trunk
changeset: 934537:8cbe4aa17351
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Jun 13 18:54:38 2020 +0000

description:
Truncate hw.sun8icryptoN.rng queries to 4096 bytes.

...rather than fail entirely.

diffstat:

 sys/arch/arm/sunxi/sun8i_crypto.c |  10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diffs (31 lines):

diff -r b5de3dd79dca -r 8cbe4aa17351 sys/arch/arm/sunxi/sun8i_crypto.c
--- a/sys/arch/arm/sunxi/sun8i_crypto.c Sat Jun 13 18:42:22 2020 +0000
+++ b/sys/arch/arm/sunxi/sun8i_crypto.c Sat Jun 13 18:54:38 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sun8i_crypto.c,v 1.14 2020/05/15 19:28:09 maxv Exp $   */
+/*     $NetBSD: sun8i_crypto.c,v 1.15 2020/06/13 18:54:38 riastradh Exp $      */
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: sun8i_crypto.c,v 1.14 2020/05/15 19:28:09 maxv Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sun8i_crypto.c,v 1.15 2020/06/13 18:54:38 riastradh Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -1203,10 +1203,8 @@
                return 0;
        }
 
-       /* Verify the output buffer size is reasonable.  */
-       size = *oldlenp;
-       if (size > 4096)        /* size_t, so never negative */
-               return E2BIG;
+       /* Truncate to 4096 bytes.  */
+       size = MIN(4096, *oldlenp);
        if (size == 0)
                return 0;       /* nothing to do */
 



Home | Main Index | Thread Index | Old Index