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

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
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -327,6 +327,7 @@ public abstract class ContentProvider implements ContentInterface, ComponentCall
        public ContentProviderResult[] applyBatch(String callingPkg, String authority,
                ArrayList<ContentProviderOperation> operations)
                throws OperationApplicationException {
            validateIncomingAuthority(authority);
            int numOperations = operations.size();
            final int[] userIds = new int[numOperations];
            for (int i = 0; i < numOperations; i++) {
@@ -447,6 +448,7 @@ public abstract class ContentProvider implements ContentInterface, ComponentCall
        @Override
        public Bundle call(String callingPkg, String authority, String method, @Nullable String arg,
                @Nullable Bundle extras) {
            validateIncomingAuthority(authority);
            Bundle.setDefusable(extras, true);
            Trace.traceBegin(TRACE_TAG_DATABASE, "call");
            final String original = setCallingPackage(callingPkg);