From 90e12ecf3c9d8a4c13ae2dd9350f86bb47188b2b Mon Sep 17 00:00:00 2001 From: Doug Flick Date: Tue, 13 Feb 2024 10:46:02 -0800 Subject: [PATCH 3/3] 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 reference: https://github.com/tianocore/edk2/pull/5372 Signed-off-by: yexiao --- NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c b/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c index eafa72eb..4c1ae0cc 100644 --- a/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c +++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c @@ -946,6 +946,11 @@ Dhcp6AppendIaOption ( *PacketCursor += sizeof (T2); } + // + // Update the packet length + // + Packet->Length += BytesNeeded; + // // Fill all the addresses belong to the Ia // @@ -957,11 +962,6 @@ Dhcp6AppendIaOption ( } } - // - // Update the packet length - // - Packet->Length += BytesNeeded; - // // Fill the value of Ia option length // -- 2.33.0