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 committed Nov 8, 2024
1 parent 7fa637b commit 91581a9
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 91581a9

Please sign in to comment.