From 75deaf5c3c0d164c61653258c331151241bb69d8 Mon Sep 17 00:00:00 2001 From: Doug Flick Date: Tue, 13 Feb 2024 10:46:02 -0800 Subject: NetworkPkg: Dhcp6Dxe: Packet-Length is not updated before appending In order for Dhcp6AppendIaAddrOption (..) to safely append the IA Address option, the Packet-Length field must be updated before appending the option. Cc: Saloni Kasbekar Cc: Zachary Clark-williams Signed-off-by: Doug Flick [MSFT] Reviewed-by: Saloni Kasbekar Reviewed-by: Leif Lindholm --- NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c') diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c b/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c index e4e0725..f38e3ee 100644 --- a/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c +++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c @@ -925,6 +925,11 @@ Dhcp6AppendIaOption ( } // + // Update the packet length + // + Packet->Length += BytesNeeded; + + // // Fill all the addresses belong to the Ia // for (Index = 0; Index < Ia->IaAddressCount; Index++) { @@ -936,11 +941,6 @@ Dhcp6AppendIaOption ( } // - // Update the packet length - // - Packet->Length += BytesNeeded; - - // // Fill the value of Ia option length // *Len = HTONS ((UINT16)(*PacketCursor - (UINT8 *)Len - 2)); -- cgit v1.1