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 9550F941B6F for ; Tue, 12 Dec 2023 19:23:57 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=aRIq//Q/zM/n3ypWfPgTd95hLe7TUHS4+5o0XZ7zFrI=; c=relaxed/simple; d=groups.io; h=DKIM-Filter:From:To:Cc:Subject:Date:Message-ID: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=1702409036; v=1; b=D0/RKJuNqzTOmOXqWRm6sKALWZ7/kqdf3vVEmUvCc7gJU4EBqk+CFaw3uasoirKSUhO4fP3h 4xyE2eEw0ysAzsUX7MgAWTzMbdR3GuuOCQYQmzbsWl9aXdCfkULEEusWQwkiABdf48A6D14qx5k MpT+qfyXnYEZgwPRq4ClUthk= X-Received: by 127.0.0.2 with SMTP id H6MMYY7687511xLNB40YPEqB; Tue, 12 Dec 2023 11:23:56 -0800 X-Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web10.5352.1702409035412331734 for ; Tue, 12 Dec 2023 11:23:55 -0800 X-Received: from localhost.localdomain (unknown [47.201.241.198]) by linux.microsoft.com (Postfix) with ESMTPSA id A5F3020B74C0; Tue, 12 Dec 2023 11:23:52 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com A5F3020B74C0 From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Ray Ni Subject: [edk2-devel] [PATCH v1 1/1] FatPkg/FatPei: Check array offset before use Date: Tue, 12 Dec 2023 14:23:36 -0500 Message-ID: <20231212192336.1917-1-mikuback@linux.microsoft.com> 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,mikuback@linux.microsoft.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: Bdj7dHU9uXynKBo8veAhnodUx7686176AA= 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="D0/RKJuN"; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=linux.microsoft.com (policy=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 From: Michael Kubacki Move the range check before array access to enforce the bounds as expected. Cc: Ray Ni Signed-off-by: Michael Kubacki --- FatPkg/FatPei/FatLiteApi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FatPkg/FatPei/FatLiteApi.c b/FatPkg/FatPei/FatLiteApi.c index cc48c4c66b7b..b89ab7009da0 100644 --- a/FatPkg/FatPei/FatLiteApi.c +++ b/FatPkg/FatPei/FatLiteApi.c @@ -459,7 +459,7 @@ GetRecoveryCapsuleInfo ( // Find corresponding physical block device // BlockDeviceNo =3D PrivateData->Volume[Index].BlockDeviceNo; - while (PrivateData->BlockDevice[BlockDeviceNo].Logical && BlockDev= iceNo < PrivateData->BlockDeviceCount) { + while (BlockDeviceNo < PrivateData->BlockDeviceCount && PrivateDat= a->BlockDevice[BlockDeviceNo].Logical) { BlockDeviceNo =3D PrivateData->BlockDevice[BlockDeviceNo].Parent= DevNo; } =20 --=20 2.43.0.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#112453): https://edk2.groups.io/g/devel/message/112453 Mute This Topic: https://groups.io/mt/103136267/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-