diff options
author | Etan Cohen <etancohen@google.com> | 2018-10-05 00:04:27 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2018-10-05 00:04:27 +0000 |
commit | c26d2bfdf8ff6f5049bd599349dbd46e5e053fb4 (patch) | |
tree | b3b1fe10649a7f2e45da5d9efe06ae27eb68dfdd /service | |
parent | 8d6c5e6b13a710a8df9a81db269e039421d64e0b (diff) | |
parent | 1cb8cdaf63f970533ef80b48ff713ed7c5b120f0 (diff) |
Merge "[RTT] Add NPE checks for invalid MAC addresses from Aware" into pi-dev
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/rtt/RttServiceImpl.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/service/java/com/android/server/wifi/rtt/RttServiceImpl.java b/service/java/com/android/server/wifi/rtt/RttServiceImpl.java index 75e75aa0f..258bdb67f 100644 --- a/service/java/com/android/server/wifi/rtt/RttServiceImpl.java +++ b/service/java/com/android/server/wifi/rtt/RttServiceImpl.java @@ -1016,8 +1016,14 @@ public class RttServiceImpl extends IWifiRttManager.Stub { RangingRequest.Builder newRequestBuilder = new RangingRequest.Builder(); for (ResponderConfig rttPeer : request.request.mRttPeers) { if (rttPeer.peerHandle != null && rttPeer.macAddress == null) { + byte[] mac = peerIdToMacMap.get(rttPeer.peerHandle.peerId); + if (mac == null || mac.length != 6) { + Log.e(TAG, "processReceivedAwarePeerMacAddresses: received an invalid MAC " + + "address for peerId=" + rttPeer.peerHandle.peerId); + continue; + } newRequestBuilder.addResponder(new ResponderConfig( - MacAddress.fromBytes(peerIdToMacMap.get(rttPeer.peerHandle.peerId)), + MacAddress.fromBytes(mac), rttPeer.peerHandle, rttPeer.responderType, rttPeer.supports80211mc, rttPeer.channelWidth, rttPeer.frequency, rttPeer.centerFreq0, rttPeer.centerFreq1, rttPeer.preamble)); |