Sets umask to prevent world readable files
Bug: 3244281
Set the umask on startup so that databases created in native code
are not world readable.
Change-Id: If0f54b209741645e173f0dd338804fabdafaa31e
diff --git a/src/com/android/browser/Browser.java b/src/com/android/browser/Browser.java
index 97b9967..12c0c41 100644
--- a/src/com/android/browser/Browser.java
+++ b/src/com/android/browser/Browser.java
@@ -16,6 +16,7 @@
package com.android.browser;
+import android.os.FileUtils;
import android.util.Log;
import android.app.Application;
@@ -47,7 +48,11 @@
public Browser() {
}
+ @Override
public void onCreate() {
+ // Set the umask so that native code creates files with the correct
+ // permissions (0660)
+ FileUtils.setUMask(FileUtils.S_IRWXO);
if (LOGV_ENABLED)
Log.v(LOGTAG, "Browser.onCreate: this=" + this);
// Fix heap utilization for better heap size characteristics.