[NTOS:MM] Add missing validation of Ordinal in MiLocateExportName (#4918)

This commit is contained in:
Hermès Bélusca-Maïto
2023-08-22 20:41:02 +02:00
parent 4e55236662
commit d8695eee1e

View File

@@ -304,6 +304,9 @@ MiLocateExportName(IN PVOID DllBase,
/* Check if we couldn't find it */
if (Ordinal == -1) return NULL;
/* Validate the ordinal */
if (Ordinal >= ExportDirectory->NumberOfFunctions) return NULL;
/* Resolve the address and write it */
ExportTable = (PULONG)((ULONG_PTR)DllBase +
ExportDirectory->AddressOfFunctions);