Source-Changes-HG archive

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

[src-draft/trunk]: src/sys/arch/arm/sunxi Truncate hw.sun8icryptoN.rng querie...



details:   https://anonhg.NetBSD.org/src-all/rev/7c00945ab5d8
branches:  trunk
changeset: 934472:7c00945ab5d8
user:      Taylor R Campbell <riastradh%NetBSD.org@localhost>
date:      Fri Jun 12 15:20:48 2020 +0000

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

...rather than fail entirely.

diffstat:

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

diffs (16 lines):

diff -r 808d7dd7d7d8 -r 7c00945ab5d8 sys/arch/arm/sunxi/sun8i_crypto.c
--- a/sys/arch/arm/sunxi/sun8i_crypto.c Sat Jun 13 16:43:32 2020 +0000
+++ b/sys/arch/arm/sunxi/sun8i_crypto.c Fri Jun 12 15:20:48 2020 +0000
@@ -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