OSDN Git Service

Tighten enforcement of file modes.
authorJeff Sharkey <jsharkey@android.com>
Thu, 28 Feb 2013 23:57:36 +0000 (15:57 -0800)
committerJeff Sharkey <jsharkey@android.com>
Thu, 28 Feb 2013 23:57:36 +0000 (15:57 -0800)
Bug: 8275867
Change-Id: I4da14f2dd0049aca69636999696c1f3c02b3b792

core/java/android/content/ContentProvider.java

index e9b800d..0ab3f1c 100644 (file)
@@ -296,7 +296,7 @@ public abstract class ContentProvider implements ComponentCallbacks2 {
 
         private void enforceFilePermission(String callingPkg, Uri uri, String mode)
                 throws FileNotFoundException, SecurityException {
-            if (mode != null && mode.startsWith("rw")) {
+            if (mode != null && mode.indexOf('w') != -1) {
                 if (enforceWritePermission(callingPkg, uri) != AppOpsManager.MODE_ALLOWED) {
                     throw new FileNotFoundException("App op not allowed");
                 }