summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2016-08-09 19:58:42 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-08-09 19:58:42 +0000
commit80ab64c562842fef49509dbf876cd29ef55c0727 (patch)
tree6dd1db77b5f1521f1bf8b73db2ac53e311660c5b /src/com/android
parent01dee865054aedb9aa7e90a8ef2c556e19af95e1 (diff)
parent14ae5650e450984f7882e022f3332852fbd2b300 (diff)
downloadandroid_packages_providers_DownloadProvider-80ab64c562842fef49509dbf876cd29ef55c0727.tar.gz
android_packages_providers_DownloadProvider-80ab64c562842fef49509dbf876cd29ef55c0727.tar.bz2
android_packages_providers_DownloadProvider-80ab64c562842fef49509dbf876cd29ef55c0727.zip
Enforce calling identity before clearing. am: 8be3a92eb0 am: ec19fe6485 am: b3ce7976f2 am: 860239d87e am: 616f47abce am: a9ea617232 am: 567e549614
am: 14ae5650e4 Change-Id: I3688aa1ad8e48901b321823f03636bbd55d76780
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/providers/downloads/DownloadProvider.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/com/android/providers/downloads/DownloadProvider.java b/src/com/android/providers/downloads/DownloadProvider.java
index d30018f7..a4bc9fef 100644
--- a/src/com/android/providers/downloads/DownloadProvider.java
+++ b/src/com/android/providers/downloads/DownloadProvider.java
@@ -1260,6 +1260,19 @@ public final class DownloadProvider extends ContentProvider {
logVerboseOpenFileInfo(uri, mode);
}
+ // Perform normal query to enforce caller identity access before
+ // clearing it to reach internal-only columns
+ final Cursor probeCursor = query(uri, new String[] {
+ Downloads.Impl._DATA }, null, null, null);
+ try {
+ if ((probeCursor == null) || (probeCursor.getCount() == 0)) {
+ throw new FileNotFoundException(
+ "No file found for " + uri + " as UID " + Binder.getCallingUid());
+ }
+ } finally {
+ IoUtils.closeQuietly(probeCursor);
+ }
+
final Cursor cursor = queryCleared(uri, new String[] {
Downloads.Impl._DATA, Downloads.Impl.COLUMN_STATUS,
Downloads.Impl.COLUMN_DESTINATION, Downloads.Impl.COLUMN_MEDIA_SCANNED }, null,