summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Kubacki <michael.kubacki@microsoft.com>2023-12-12 14:00:40 -0500
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2023-12-14 21:52:09 +0000
commit3ce5f2d445e51efe2aebaa227a055e5c8522d00b (patch)
treeadab6f7f5f738cf774154b86efc74c70623b1cd9
parent7f5e75895bd6bbfbde191fb8458d324033f76c57 (diff)
downloadedk2-3ce5f2d445e51efe2aebaa227a055e5c8522d00b.tar.gz
edk2-3ce5f2d445e51efe2aebaa227a055e5c8522d00b.tar.bz2
edk2-3ce5f2d445e51efe2aebaa227a055e5c8522d00b.zip
FatPkg/FatPei: Check array offset before use
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> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
-rw-r--r--FatPkg/FatPei/FatLiteApi.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/FatPkg/FatPei/FatLiteApi.c b/FatPkg/FatPei/FatLiteApi.c
index cc48c4c66b..b89ab7009d 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;
}