Skip to content

Commit

Permalink
Fix authentication error of transactRemote with IBinder.FLAG_ONEWAY
Browse files Browse the repository at this point in the history
When FLAG_ONEWAY is used, Binder#getCallingUid/Pid returns 0.

RikkaApps/Sui#35
  • Loading branch information
RikkaW committed Oct 29, 2022
1 parent 63d7d5c commit 71a990b
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ public final void transactRemote(Parcel data, Parcel reply, int flags) throws Re

IBinder targetBinder = data.readStrongBinder();
int targetCode = data.readInt();
int targetFlags = data.readInt();

LOGGER.d("transact: uid=%d, descriptor=%s, code=%d", Binder.getCallingUid(), targetBinder.getInterfaceDescriptor(), targetCode);
Parcel newData = Parcel.obtain();
Expand All @@ -148,7 +149,7 @@ public final void transactRemote(Parcel data, Parcel reply, int flags) throws Re
}
try {
long id = Binder.clearCallingIdentity();
targetBinder.transact(targetCode, newData, reply, flags);
targetBinder.transact(targetCode, newData, reply, targetFlags);
Binder.restoreCallingIdentity(id);
} finally {
newData.recycle();
Expand Down

0 comments on commit 71a990b

Please sign in to comment.