Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Snippets Groups Projects
Commit 2de00bf3 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Validate incoming authority values.

A single provider may offer multiple authorities, so we now pass along
the authority being requested.  However, we need to validate that the
authority is actually serviced by the provider, similar to what we do
in validateIncomingUri().

Bug: 120673301
Test: atest android.content.cts
Test: atest android.provider.cts
Change-Id: Ia9734a42558ee9d46dc54f7e12b596cf03a520f5
parent 95268aeb
No related branches found
No related tags found
No related merge requests found
...@@ -327,6 +327,7 @@ public abstract class ContentProvider implements ContentInterface, ComponentCall ...@@ -327,6 +327,7 @@ public abstract class ContentProvider implements ContentInterface, ComponentCall
public ContentProviderResult[] applyBatch(String callingPkg, String authority, public ContentProviderResult[] applyBatch(String callingPkg, String authority,
ArrayList<ContentProviderOperation> operations) ArrayList<ContentProviderOperation> operations)
throws OperationApplicationException { throws OperationApplicationException {
validateIncomingAuthority(authority);
int numOperations = operations.size(); int numOperations = operations.size();
final int[] userIds = new int[numOperations]; final int[] userIds = new int[numOperations];
for (int i = 0; i < numOperations; i++) { for (int i = 0; i < numOperations; i++) {
...@@ -447,6 +448,7 @@ public abstract class ContentProvider implements ContentInterface, ComponentCall ...@@ -447,6 +448,7 @@ public abstract class ContentProvider implements ContentInterface, ComponentCall
@Override @Override
public Bundle call(String callingPkg, String authority, String method, @Nullable String arg, public Bundle call(String callingPkg, String authority, String method, @Nullable String arg,
@Nullable Bundle extras) { @Nullable Bundle extras) {
validateIncomingAuthority(authority);
Bundle.setDefusable(extras, true); Bundle.setDefusable(extras, true);
Trace.traceBegin(TRACE_TAG_DATABASE, "call"); Trace.traceBegin(TRACE_TAG_DATABASE, "call");
final String original = setCallingPackage(callingPkg); final String original = setCallingPackage(callingPkg);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment