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 49349780091 for ; Tue, 27 Feb 2024 00:52:52 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=tD6af+nK1lnbqupbiVtXvUAVc/JXZGyeS5VgyB+JqyY=; c=relaxed/simple; d=groups.io; h=Feedback-ID:Message-ID:Date:MIME-Version:User-Agent:Subject:To:Cc:References:From:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1708995171; v=1; b=jdyb9aGF9aShK2RqUlz3cV1opzSpGuunSjqHk01KDdgh6Xx4j/onbwEJGs23zxp/39u4pcBs jLyeZ/awlIJ3NKhuy4y4qe4QOqQAfRQjx0KG1E1l+KXzpeY90Tb7zZViT1AgkXAi+scizGbK1Vb 3aexOY3C83n0YWa8saUg+MTw= X-Received: by 127.0.0.2 with SMTP id esDzYY7687511xTHfAtWKlds; Mon, 26 Feb 2024 16:52:51 -0800 X-Received: from wfout1-smtp.messagingengine.com (wfout1-smtp.messagingengine.com [64.147.123.144]) by mx.groups.io with SMTP id smtpd.web10.2053.1708995170986489577 for ; Mon, 26 Feb 2024 16:52:51 -0800 X-Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailfout.west.internal (Postfix) with ESMTP id D08461C0007E; Mon, 26 Feb 2024 19:52:47 -0500 (EST) X-Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 26 Feb 2024 19:52:48 -0500 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrgeefgddvjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefkffggfgfuvfevfhfhjggtgfesthejredttddvjeenucfhrhhomheptfgvsggv tggtrgcuvehrrghnuceorhgvsggvtggtrgessghsughiohdrtghomheqnecuggftrfgrth htvghrnhephfekvdekvdfhtddvteehueeuleetjefhieehjeeuhfdtuddtvdeguddtkeev lefhnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprh gvsggvtggtrgessghsughiohdrtghomh X-ME-Proxy: Feedback-ID: i5b994698:Fastmail X-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 26 Feb 2024 19:52:45 -0500 (EST) Message-ID: <8ad1f71e-ac77-49fb-88e1-5a0e0ade7c83@bsdio.com> Date: Mon, 26 Feb 2024 17:52:41 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [edk2-devel] [PATCH v1 1/1] MdeModulePkg/Bus/Usb/UsbNetwork: Check array index range before access To: mikuback@linux.microsoft.com, devel@edk2.groups.io Cc: Liming Gao , Ray Ni , Richard Ho References: <20240220152157.212-1-mikuback@linux.microsoft.com> From: "Rebecca Cran" In-Reply-To: <20240220152157.212-1-mikuback@linux.microsoft.com> 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,rebecca@bsdio.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: xPk9jklJ3q66NAhH4ANzWDUEx7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed 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=jdyb9aGF; dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Reviewed-by: Rebecca Cran On 2/20/2024 8:21 AM, mikuback@linux.microsoft.com wrote: > From: Michael Kubacki > > Checks that an offset used to access array elements is within the > expected range before accessing the array item. > > Cc: Liming Gao > Cc: Ray Ni > Cc: Rebecca Cran > Cc: Richard Ho > Signed-off-by: Michael Kubacki > --- > MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcEcm/UsbEcmFunction.c | 2 +- > MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcNcm/UsbNcmFunction.c | 2 +- > MdeModulePkg/Bus/Usb/UsbNetwork/UsbRndis/UsbRndisFunction.c | 2 +- > 3 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcEcm/UsbEcmFunction.c b= /MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcEcm/UsbEcmFunction.c > index 29f4508a38ce..0c1f252b85df 100644 > --- a/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcEcm/UsbEcmFunction.c > +++ b/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcEcm/UsbEcmFunction.c > @@ -769,7 +769,7 @@ ConvertFilter ( > =20 > Count =3D sizeof (gTable)/sizeof (gTable[0]); > =20 > - for (Index =3D 0; (gTable[Index].Src !=3D 0) && (Index < Count); Index= ++) { > + for (Index =3D 0; (Index < Count) && (gTable[Index].Src !=3D 0); Index= ++) { > if (gTable[Index].Src & Value) { > *CdcFilter |=3D gTable[Index].Dst; > } > diff --git a/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcNcm/UsbNcmFunction.c b= /MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcNcm/UsbNcmFunction.c > index baa2225bf8a8..ef01a6f5458c 100644 > --- a/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcNcm/UsbNcmFunction.c > +++ b/MdeModulePkg/Bus/Usb/UsbNetwork/UsbCdcNcm/UsbNcmFunction.c > @@ -855,7 +855,7 @@ ConvertFilter ( > =20 > Count =3D sizeof (gTable)/sizeof (gTable[0]); > =20 > - for (Index =3D 0; (gTable[Index].Src !=3D 0) && (Index < Count); Index= ++) { > + for (Index =3D 0; (Index < Count) && (gTable[Index].Src !=3D 0); Index= ++) { > if (gTable[Index].Src & Value) { > *CdcFilter |=3D gTable[Index].Dst; > } > diff --git a/MdeModulePkg/Bus/Usb/UsbNetwork/UsbRndis/UsbRndisFunction.c = b/MdeModulePkg/Bus/Usb/UsbNetwork/UsbRndis/UsbRndisFunction.c > index 2c0dcae4cf96..6d45a1b775ba 100644 > --- a/MdeModulePkg/Bus/Usb/UsbNetwork/UsbRndis/UsbRndisFunction.c > +++ b/MdeModulePkg/Bus/Usb/UsbNetwork/UsbRndis/UsbRndisFunction.c > @@ -803,7 +803,7 @@ ConvertFilter ( > =20 > Count =3D sizeof (gTable)/sizeof (gTable[0]); > =20 > - for (Index =3D 0; (gTable[Index].Src !=3D 0) && (Index < Count); Index= ++) { > + for (Index =3D 0; (Index < Count) && (gTable[Index].Src !=3D 0); Index= ++) { > if (gTable[Index].Src & Value) { > *CdcFilter |=3D gTable[Index].Dst; > } -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#115992): https://edk2.groups.io/g/devel/message/115992 Mute This Topic: https://groups.io/mt/104469090/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-