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/690148918c1f
branches:  trunk
changeset: 934506:690148918c1f
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 2ba01da38623 -r 690148918c1f sys/arch/arm/sunxi/sun8i_crypto.c
--- a/sys/arch/arm/sunxi/sun8i_crypto.c Fri Jun 12 04:35:16 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