changeset 10818:a63130625342

8048512: Uninitialised memory in jdk/src/share/native/sun/security/ec/ECC_JNI.cpp Reviewed-by: mullan
author vinnie
date Fri, 03 Oct 2014 13:07:05 +0100
parents d37a314f2f64
children 21568031434d e2fd52e1d86e
files src/jdk.crypto.ec/share/native/libsunec/ECC_JNI.cpp
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.crypto.ec/share/native/libsunec/ECC_JNI.cpp	Fri Oct 03 12:44:30 2014 +0400
+++ b/src/jdk.crypto.ec/share/native/libsunec/ECC_JNI.cpp	Fri Oct 03 13:07:05 2014 +0100
@@ -211,6 +211,7 @@
     digest_item.len = jDigestLength;
 
     ECPrivateKey privKey;
+    privKey.privateValue.data = NULL;
 
     // Initialize the ECParams struct
     ECParams *ecparams = NULL;
@@ -387,9 +388,14 @@
 {
     jbyteArray jSecret = NULL;
     ECParams *ecparams = NULL;
+    SECItem privateValue_item;
+    privateValue_item.data = NULL;
+    SECItem publicValue_item;
+    publicValue_item.data = NULL;
+    SECKEYECParams params_item;
+    params_item.data = NULL;
 
     // Extract private key value
-    SECItem privateValue_item;
     privateValue_item.len = env->GetArrayLength(privateKey);
     privateValue_item.data =
             (unsigned char *) env->GetByteArrayElements(privateKey, 0);
@@ -398,7 +404,6 @@
     }
 
     // Extract public key value
-    SECItem publicValue_item;
     publicValue_item.len = env->GetArrayLength(publicKey);
     publicValue_item.data =
         (unsigned char *) env->GetByteArrayElements(publicKey, 0);
@@ -407,7 +412,6 @@
     }
 
     // Initialize the ECParams struct
-    SECKEYECParams params_item;
     params_item.len = env->GetArrayLength(encodedParams);
     params_item.data =
         (unsigned char *) env->GetByteArrayElements(encodedParams, 0);