Security fix: enforce read privilege permission to check package
privileges in PhoneInterfaceManager
Bug: 180938364
Test: cts
Change-Id: I03ae773fa76f2f23842eee0b7a9948ca474befc8
diff --git a/src/com/android/phone/TelephonyShellCommand.java b/src/com/android/phone/TelephonyShellCommand.java
index 8fc7e94..f5b6ad8 100644
--- a/src/com/android/phone/TelephonyShellCommand.java
+++ b/src/com/android/phone/TelephonyShellCommand.java
@@ -2295,6 +2295,7 @@
String packageName = getNextArgRequired();
boolean hasCarrierPrivileges;
+ final long token = Binder.clearCallingIdentity();
try {
hasCarrierPrivileges =
mInterface.checkCarrierPrivilegesForPackageAnyPhone(packageName)
@@ -2303,6 +2304,8 @@
Log.w(LOG_TAG, HAS_CARRIER_PRIVILEGES_COMMAND + " exception", e);
getErrPrintWriter().println("Exception: " + e.getMessage());
return -1;
+ } finally {
+ Binder.restoreCallingIdentity(token);
}
getOutPrintWriter().println(hasCarrierPrivileges);