From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 0E45C740039 for ; Sat, 10 Feb 2024 02:05:01 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=crIkcUCdQ4sEoGpJEBGrHjmZR6iDkBur7+uyAiXxxjg=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1707530700; v=1; b=UaqRHw7M4oRxkmvPvYz1JvQcE3+4JxNvfQaBkyoIGeKW4Q5holsKK3uWysw9UNV6j1dtf0eN 0myFZil78lrsdUhRyJ0usr/p+VerfFFfAtaOi6vGybXErp++9P2WfwJpPW0HU+BDtI4K0Q8Had+ CIy74m3gwqZl8bTpt6iTtSew= X-Received: by 127.0.0.2 with SMTP id LkVUYY7687511xByXGYSjpLM; Fri, 09 Feb 2024 18:05:00 -0800 X-Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) by mx.groups.io with SMTP id smtpd.web10.5801.1707530699967841857 for ; Fri, 09 Feb 2024 18:05:00 -0800 X-Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-6e0a37751cbso330526b3a.2 for ; Fri, 09 Feb 2024 18:04:59 -0800 (PST) X-Gm-Message-State: GFL4Yc8jD6yLhAG3t8ynTOWBx7686176AA= X-Google-Smtp-Source: AGHT+IEgeoqiHk0/UaJAPgCQUARbUmiLt0svP2w1Bi9whoJGAXJGTOyyVJjMILmOkXR3d4qPZEUY8w== X-Received: by 2002:a05:6a00:1b52:b0:6dd:e398:2a84 with SMTP id o18-20020a056a001b5200b006dde3982a84mr973074pfv.7.1707530699260; Fri, 09 Feb 2024 18:04:59 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVurjUpH+nIoV+EzRuvWWGV2P2AJ1nfTAucBUFiqL6BzObVY7E98aUyn0/APU32pi29xrMRp1NWw5KH7pEXozBe/2bQ8FYzun18IeljrO1nzN9sxWzW1Bq3CxiewXzuZigfhoOvY91OaWWlNgxoUNZDM2PlEcp1dGDGiGSw5ZyubIjqkDmEa9B2KDv8W0VHqUlynWVEcpomf7hN2JKGGCkOKeSW8NBdIQs9FAet79i4ZClv2xwa0Ve1N+B1OSzhrh1c+HoAvhYasQ== X-Received: from localhost.localdomain ([24.17.138.83]) by smtp.gmail.com with ESMTPSA id r9-20020aa79ec9000000b006e04dd8876csm1197489pfq.210.2024.02.09.18.04.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 18:04:58 -0800 (PST) From: "Doug Flick via groups.io" To: devel@edk2.groups.io Cc: Doug Flick , Saloni Kasbekar , Zachary Clark-williams , Andrew Fish , Leif Lindholm , Michael D Kinney , "Doug Flick [MSFT]" Subject: [edk2-devel] [PATCH 2/3] [edk2-stable202402] NetworkPkg: Dhcp6Dxe: Additional Code Cleanup Date: Fri, 9 Feb 2024 19:04:57 -0800 Message-ID: <25e7367bd09b43a4f4d9e084ad5019dcd1f28446.1707534069.git.doug.edk2@gmail.com> In-Reply-To: References: MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,dougflick@microsoft.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=UaqRHw7M; dmarc=pass (policy=none) header.from=groups.io; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io From: Doug Flick Removes duplicate check after merge > > // > // Verify the PacketCursor is within the packet > // > if ( (*PacketCursor < Packet->Dhcp6.Option) > || (*PacketCursor >=3D Packet->Dhcp6.Option + (Packet->Size - sizeof (EFI_DHCP6_HEADER)))) > { > return EFI_INVALID_PARAMETER; > } > Additionally Calculates the Packet->Length before appending Cc: Saloni Kasbekar Cc: Zachary Clark-williams Cc: Andrew Fish Cc: Leif Lindholm Cc: Michael D Kinney Signed-off-by: Doug Flick [MSFT] --- NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c b/NetworkPkg/Dhcp6Dxe/Dhcp6= Utility.c index 705c665c519d..348602c4e1a8 100644 --- a/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c +++ b/NetworkPkg/Dhcp6Dxe/Dhcp6Utility.c @@ -657,15 +657,6 @@ Dhcp6AppendOption ( return EFI_BUFFER_TOO_SMALL;=0D }=0D =0D - //=0D - // Verify the PacketCursor is within the packet=0D - //=0D - if ( (*PacketCursor < Packet->Dhcp6.Option)=0D - || (*PacketCursor >=3D Packet->Dhcp6.Option + (Packet->Size - sizeof = (EFI_DHCP6_HEADER))))=0D - {=0D - return EFI_INVALID_PARAMETER;=0D - }=0D -=0D WriteUnaligned16 ((UINT16 *)*PacketCursor, OptType);=0D *PacketCursor +=3D DHCP6_SIZE_OF_OPT_CODE;=0D WriteUnaligned16 ((UINT16 *)*PacketCursor, OptLen);=0D @@ -929,6 +920,11 @@ Dhcp6AppendIaOption ( *PacketCursor +=3D sizeof (T2);=0D }=0D =0D + //=0D + // Update the packet length=0D + //=0D + Packet->Length +=3D BytesNeeded;=0D +=0D //=0D // Fill all the addresses belong to the Ia=0D //=0D @@ -945,11 +941,6 @@ Dhcp6AppendIaOption ( //=0D *Len =3D HTONS ((UINT16)(*PacketCursor - (UINT8 *)Len - 2));=0D =0D - //=0D - // Update the packet length=0D - //=0D - Packet->Length +=3D BytesNeeded;=0D -=0D return EFI_SUCCESS;=0D }=0D =0D @@ -957,6 +948,7 @@ Dhcp6AppendIaOption ( Append the appointed Elapsed time option to Buf, and move Buf to the end= .=0D =0D @param[in, out] Packet A pointer to the packet, on success Packet= ->Length=0D + will be updated.=0D @param[in, out] PacketCursor The pointer in the packet, on success Pack= etCursor=0D will be moved to the end of the option.=0D @param[in] Instance The pointer to the Dhcp6 instance.=0D --=20 2.43.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#115340): https://edk2.groups.io/g/devel/message/115340 Mute This Topic: https://groups.io/mt/104272127/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-