* [edk2-devel] [PATCH v1 1/1] FatPkg/FatPei: Check array offset before use
@ 2023-12-12 19:23 Michael Kubacki
2023-12-12 23:27 ` Michael D Kinney
0 siblings, 1 reply; 2+ messages in thread
From: Michael Kubacki @ 2023-12-12 19:23 UTC (permalink / raw)
To: devel; +Cc: Ray Ni
From: Michael Kubacki <michael.kubacki@microsoft.com>
Move the range check before array access to enforce the bounds
as expected.
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
---
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 = PrivateData->Volume[Index].BlockDeviceNo;
- while (PrivateData->BlockDevice[BlockDeviceNo].Logical && BlockDeviceNo < PrivateData->BlockDeviceCount) {
+ while (BlockDeviceNo < PrivateData->BlockDeviceCount && PrivateData->BlockDevice[BlockDeviceNo].Logical) {
BlockDeviceNo = PrivateData->BlockDevice[BlockDeviceNo].ParentDevNo;
}
--
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]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [edk2-devel] [PATCH v1 1/1] FatPkg/FatPei: Check array offset before use
2023-12-12 19:23 [edk2-devel] [PATCH v1 1/1] FatPkg/FatPei: Check array offset before use Michael Kubacki
@ 2023-12-12 23:27 ` Michael D Kinney
0 siblings, 0 replies; 2+ messages in thread
From: Michael D Kinney @ 2023-12-12 23:27 UTC (permalink / raw)
To: devel@edk2.groups.io, mikuback@linux.microsoft.com
Cc: Ni, Ray, Kinney, Michael D
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Michael
> Kubacki
> Sent: Tuesday, December 12, 2023 11:24 AM
> To: devel@edk2.groups.io
> Cc: Ni, Ray <ray.ni@intel.com>
> Subject: [edk2-devel] [PATCH v1 1/1] FatPkg/FatPei: Check array offset
> before use
>
> From: Michael Kubacki <michael.kubacki@microsoft.com>
>
> Move the range check before array access to enforce the bounds
> as expected.
>
> Cc: Ray Ni <ray.ni@intel.com>
> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
> ---
> 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 = PrivateData->Volume[Index].BlockDeviceNo;
> - while (PrivateData->BlockDevice[BlockDeviceNo].Logical &&
> BlockDeviceNo < PrivateData->BlockDeviceCount) {
> + while (BlockDeviceNo < PrivateData->BlockDeviceCount &&
> PrivateData->BlockDevice[BlockDeviceNo].Logical) {
> BlockDeviceNo = PrivateData-
> >BlockDevice[BlockDeviceNo].ParentDevNo;
> }
>
> --
> 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/1643496
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub
> [michael.d.kinney@intel.com]
> -=-=-=-=-=-=
>
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112460): https://edk2.groups.io/g/devel/message/112460
Mute This Topic: https://groups.io/mt/103136267/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/xyzzy [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-12-12 23:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-12 19:23 [edk2-devel] [PATCH v1 1/1] FatPkg/FatPei: Check array offset before use Michael Kubacki
2023-12-12 23:27 ` Michael D Kinney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox