]> xenbits.xensource.com Git - people/aperard/ovmf.git/commitdiff
NetworkPkg: Dhcp6Dxe: Packet-Length is not updated before appending
authorDoug Flick <dougflick@microsoft.com>
Tue, 13 Feb 2024 18:46:02 +0000 (10:46 -0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Wed, 14 Feb 2024 03:28:11 +0000 (03:28 +0000)
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>
NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c

index e4e072562296ffbe2a753027676b98182e40d5fa..f38e3ee3fe1a0cc01e377eb2f20c1d54e4f5ced0 100644 (file)
@@ -924,6 +924,11 @@ Dhcp6AppendIaOption (
     *PacketCursor += sizeof (T2);\r
   }\r
 \r
+  //\r
+  // Update the packet length\r
+  //\r
+  Packet->Length += BytesNeeded;\r
+\r
   //\r
   // Fill all the addresses belong to the Ia\r
   //\r
@@ -935,11 +940,6 @@ Dhcp6AppendIaOption (
     }\r
   }\r
 \r
-  //\r
-  // Update the packet length\r
-  //\r
-  Packet->Length += BytesNeeded;\r
-\r
   //\r
   // Fill the value of Ia option length\r
   //\r