You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by na...@apache.org on 2014/10/27 22:24:55 UTC

[4/8] git commit: Replacing Math.random() with something a little more random.

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 <bo...@apache.org>
Authored: Tue Oct 14 10:11:09 2014 -0700
Committer: Prabhjot Singh <pr...@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