summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Flick <dougflick@microsoft.com>2024-02-13 10:46:02 -0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-02-14 03:28:11 +0000
commit75deaf5c3c0d164c61653258c331151241bb69d8 (patch)
treead1aa35a0d1aa3cdd9d899ea954c08d99ff18c7a
parentaf3fad99d6088881562e50149f414f76a5be0140 (diff)
downloadedk2-75deaf5c3c0d164c61653258c331151241bb69d8.tar.gz
edk2-75deaf5c3c0d164c61653258c331151241bb69d8.tar.bz2
edk2-75deaf5c3c0d164c61653258c331151241bb69d8.zip
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 <saloni.kasbekar@intel.com> Cc: Zachary Clark-williams <zachary.clark-williams@intel.com> Signed-off-by: Doug Flick [MSFT] <doug.edk2@gmail.com> Reviewed-by: Saloni Kasbekar <saloni.kasbekar@intel.com> Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>
-rw-r--r--NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c b/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c
index e4e0725622..f38e3ee3fe 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));