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 pas end of buffer.

Signed-off-by: Michael D Kinney <[email protected]>
  • Loading branch information
mdkinney committed Nov 5, 2024
1 parent d8b676f commit e349a3b
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 e349a3b

Please sign in to comment.