Skip to content

Commit

Permalink
UefiCpuPkg/MtrrLib: Fix unit test read overflow
Browse files Browse the repository at this point in the history
Change conditional check to check the array index before
reading the array member to prevent read past end of buffer.

Signed-off-by: Michael D Kinney <[email protected]>
  • Loading branch information
mdkinney authored and mergify[bot] committed Nov 11, 2024
1 parent fadf4f3 commit 171335e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion UefiCpuPkg/Library/MtrrLib/UnitTest/Support.c
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ GetNextDifferentElementInSortedArray (
UINT64 CurrentElement;

CurrentElement = Array[Index];
while (CurrentElement == Array[Index] && Index < Count) {
while ((Index < Count) && (CurrentElement == Array[Index])) {
Index++;
}

Expand Down

0 comments on commit 171335e

Please sign in to comment.