harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r569338 - /harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/File.java
Date Fri, 24 Aug 2007 10:42:09 GMT
Author: tellison
Date: Fri Aug 24 03:41:48 2007
New Revision: 569338

URL: http://svn.apache.org/viewvc?rev=569338&view=rev
Log:
Fix for HARMONY-4663 ([classlib][luni]File.createTempFile() is insecure)

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/File.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/File.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/File.java?rev=569338&r1=569337&r2=569338&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/File.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/File.java Fri Aug 24
03:41:48 2007
@@ -21,6 +21,7 @@
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.security.AccessController;
+import java.security.SecureRandom;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -1158,7 +1159,7 @@
 
     private static File genTempFile(String prefix, String suffix, File directory) {
         if (counter == 0) {
-            int newInt = new java.util.Random().nextInt();
+            int newInt = new SecureRandom().nextInt();
             counter = ((newInt / 65535) & 0xFFFF) + 0x2710;
         }
         StringBuilder newName = new StringBuilder();



Mime
View raw message