kern: add new overflow checks on KMemoryRegions

This commit is contained in:
Michael Scire
2020-12-01 17:14:23 -08:00
parent 866310937a
commit a56bdab820
8 changed files with 32 additions and 1 deletions

View File

@@ -92,6 +92,9 @@ namespace ams::kern::svc {
/* Ensure that we found the region. */
R_UNLESS(region != nullptr, svc::ResultNotFound());
/* Chcek that the region is valid. */
MESOSPHERE_ABORT_UNLESS(region->GetEndAddress() != 0);
R_TRY(pt.QueryStaticMapping(std::addressof(found_address), region->GetAddress(), region->GetSize()));
found_size = region->GetSize();
}