[FREELDR] Initialize CandidatePageCount to zero, needed if the while-loop is not run.

Granted, if the while-loop is not run, this means there is no memory
available at all on the computer where FreeLdr is running, which is
quite unexpected. But do the initialization anyways, in order to avoid
more obscure bugs down the line.

On the other hand, PageLookupTableMemAddress doesn't need to be
pre-initialized, since it gets initialized unconditionally afterwards.
This commit is contained in:
Hermès Bélusca-Maïto 2024-03-10 16:20:16 +01:00
parent 61c4b5f615
commit 9a707af2e3
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0

View file

@ -419,9 +419,9 @@ PVOID MmFindLocationForPageLookupTable(PFN_NUMBER TotalPageCount)
SIZE_T PageLookupTableSize;
PFN_NUMBER RequiredPages;
PFN_NUMBER CandidateBasePage = 0;
PFN_NUMBER CandidatePageCount;
PFN_NUMBER CandidatePageCount = 0;
PFN_NUMBER PageLookupTableEndPage;
PVOID PageLookupTableMemAddress = NULL;
PVOID PageLookupTableMemAddress;
// Calculate how much pages we need to keep the page lookup table
PageLookupTableSize = TotalPageCount * sizeof(PAGE_LOOKUP_TABLE_ITEM);