diff --git a/UefiTestingPkg/AuditTests/PagingAudit/UEFI/PagingAuditCommon.c b/UefiTestingPkg/AuditTests/PagingAudit/UEFI/PagingAuditCommon.c index 14514ea5b4..9cb38f638a 100644 --- a/UefiTestingPkg/AuditTests/PagingAudit/UEFI/PagingAuditCommon.c +++ b/UefiTestingPkg/AuditTests/PagingAudit/UEFI/PagingAuditCommon.c @@ -1606,7 +1606,7 @@ DumpPagingInfo ( StringLength = 0; // Calculate the string size of the Loaded Image Table - Status = LoadedImageTableDump (TRUE, &StringLength); + Status = LoadedImageTableDump (FALSE, &StringLength); if (EFI_ERROR (Status) && (Status != EFI_NOT_STARTED)) { DEBUG ((DEBUG_ERROR, "%a - Error tabulating required string size for the loaded image info in the memory info database\n", __func__)); @@ -1650,6 +1650,9 @@ DumpPagingInfo ( goto Cleanup; } + // Prevent a stale, non-zero offset from writing past the beginning of the buffer. + mMemoryInfoDatabaseSize = 0; + if (mPteCounts[EntryGuard] > 0) { // Calculate the string size of the guard page entries Status = GuardPageDump (mPteEntries[EntryGuard], mPteCounts[EntryGuard], TRUE);