diff options
author | Roshan Pius <rpius@google.com> | 2017-08-01 17:08:40 -0700 |
---|---|---|
committer | Roshan Pius <rpius@google.com> | 2017-08-02 10:49:03 -0700 |
commit | a49af7fd6bf5d51ef7c34fbf2d71ee10c0f7d1dd (patch) | |
tree | ac89cfdf107cc507e032f1e016c61fb1ebda7df2 /service | |
parent | b1d6ef28f4a40b4b7384859b52b176d55f7d4bae (diff) |
WifiStateMachine: Always return a copy of WifiInfo
WifiStateMachine#syncRequestConnectionInfo() should always return a copy
of WifiInfo to prevent external services directly accessing a local
variable in WifiStateMachine. Binder calls within the same process
doesn't parcel objects, hence this is needed to prevent other threads in
system_server directly using a local object within the wifi service.
Bug: 64207440
Test: Unit test that checks for object returned from
WifiStateMachine#getWifiInfo() vs
WifiStateMachine#syncRequestConnectionInfo().
Change-Id: I3d709a09d3d10a1d133fd79eeee430830eb008b2
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/WifiStateMachine.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java index efea94b78..5f970026f 100644 --- a/service/java/com/android/server/wifi/WifiStateMachine.java +++ b/service/java/com/android/server/wifi/WifiStateMachine.java @@ -1758,9 +1758,9 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss */ public WifiInfo syncRequestConnectionInfo() { int uid = Binder.getCallingUid(); - if (uid == Process.myUid()) return mWifiInfo; - boolean hideBssidAndSsid = true; WifiInfo result = new WifiInfo(mWifiInfo); + if (uid == Process.myUid()) return result; + boolean hideBssidAndSsid = true; result.setMacAddress(WifiInfo.DEFAULT_MAC_ADDRESS); IPackageManager packageManager = AppGlobals.getPackageManager(); |