changeset 8864:0b3f852e7c79

8220192: Better outlook for SecureRandom Reviewed-by: andrew
author mbalao
date Thu, 04 Jul 2019 18:18:04 +0100
parents 38a27fe884b2
children 4af0fe462f02
files src/windows/native/sun/security/mscapi/security.cpp
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/windows/native/sun/security/mscapi/security.cpp	Mon Jul 15 05:11:27 2019 +0100
+++ b/src/windows/native/sun/security/mscapi/security.cpp	Thu Jul 04 18:18:04 2019 +0100
@@ -202,14 +202,17 @@
         }
 
         /*
-         * If length is negative then use the supplied seed to re-seed the
-         * generator and return null.
+         * If length is negative and a seed is supplied, use it to re-seed the
+         * generator. Return null whether a seed is supplied or not.
          * If length is non-zero then generate a new seed according to the
          * requested length and return the new seed.
          * If length is zero then overwrite the supplied seed with a new
          * seed of the same length and return the seed.
          */
         if (length < 0) {
+            if (seed == NULL) {
+                __leave;
+            }
             length = env->GetArrayLength(seed);
             if ((reseedBytes = env->GetByteArrayElements(seed, 0)) == NULL) {
                 __leave;