cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From na...@apache.org
Subject [4/8] git commit: Replacing Math.random() with something a little more random.
Date Mon, 27 Oct 2014 21:24:55 GMT
Replacing Math.random() with something a little more random.


Project: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/commit/dd923761
Tree: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/tree/dd923761
Diff: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/diff/dd923761

Branch: refs/heads/master
Commit: dd92376108206a924137979bd6d6788f4d266286
Parents: 76044fa
Author: Joe Bowser <bowserj@apache.org>
Authored: Tue Oct 14 10:11:09 2014 -0700
Committer: Prabhjot Singh <prabhjos@amazon.com>
Committed: Mon Oct 20 10:05:29 2014 +0530

----------------------------------------------------------------------
 framework/src/org/apache/cordova/CordovaBridge.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/dd923761/framework/src/org/apache/cordova/CordovaBridge.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaBridge.java b/framework/src/org/apache/cordova/CordovaBridge.java
index 081127d..a6ebebb 100644
--- a/framework/src/org/apache/cordova/CordovaBridge.java
+++ b/framework/src/org/apache/cordova/CordovaBridge.java
@@ -18,6 +18,8 @@
 */
 package org.apache.cordova;
 
+import java.security.SecureRandom;
+
 import org.apache.cordova.PluginManager;
 import org.json.JSONArray;
 import org.json.JSONException;
@@ -107,7 +109,8 @@ public class CordovaBridge {
 
     /** Called by cordova.js to initialize the bridge. */
     int generateBridgeSecret() {
-        expectedBridgeSecret = (int)(Math.random() * Integer.MAX_VALUE);
+        SecureRandom randGen = new SecureRandom();
+        expectedBridgeSecret = (int)(randGen.nextInt() * Integer.MAX_VALUE);
         return expectedBridgeSecret;
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message