summaryrefslogtreecommitdiff
path: root/src/android/net/dhcp/DhcpClient.java
diff options
context:
space:
mode:
authorXiao Ma <xiaom@google.com>2020-01-10 12:00:15 +0900
committerXiao Ma <xiaom@google.com>2020-01-20 07:11:15 +0000
commit98b659374f6a28a7ee80f8264016eaea72953419 (patch)
tree24f4bda1370ed81162953b8bb5a9957fd35330c7 /src/android/net/dhcp/DhcpClient.java
parentd22d5b2870ccea8de9842dc728421ca235053d6c (diff)
Return actual payload (DHCPDISCOVER) bytes array when starting FILS.
Generally "ByteBuffer packet" has been allocated with a maximum length of 1500. Calling packet.array() is to return a byte array of length 1500 but the actual DHCPDISCOVER packet payload is much less. Return actual DHCP packet byte array instead in this patch, which allows caller use the payload byte array directly without extra operation (e.g. calling packet.remaining() to get the correct length of actual payload). Bug: 140223017 Test: atest NetworkStackTests NetworkStackIntegrationTests Change-Id: Ib08f2450fb649ea1ffcdbf8dedc829965f13da86
Diffstat (limited to 'src/android/net/dhcp/DhcpClient.java')
-rw-r--r--src/android/net/dhcp/DhcpClient.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/android/net/dhcp/DhcpClient.java b/src/android/net/dhcp/DhcpClient.java
index 8aa739a..b429923 100644
--- a/src/android/net/dhcp/DhcpClient.java
+++ b/src/android/net/dhcp/DhcpClient.java
@@ -1270,7 +1270,7 @@ public class DhcpClient extends StateMachine {
DO_UNICAST, REQUESTED_PARAMS, true /* rapid commit */, mHostname);
l2Packet.dstMacAddress = MacAddress.fromBytes(DhcpPacket.ETHER_BROADCAST);
- l2Packet.payload = packet.array();
+ l2Packet.payload = Arrays.copyOf(packet.array(), packet.limit());
mController.sendMessage(CMD_START_PRECONNECTION, l2Packet);
}
}