mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-24 03:36:52 -04:00
kern: add new overflow checks on KMemoryRegions
This commit is contained in:
parent
748893fe77
commit
0a1465f198
8 changed files with 32 additions and 1 deletions
|
@ -1807,6 +1807,9 @@ namespace ams::kern {
|
|||
const KMemoryRegion *region = KMemoryLayout::GetPhysicalMemoryRegionTree().FindFirstDerived(region_type);
|
||||
R_UNLESS(region != nullptr, svc::ResultOutOfRange());
|
||||
|
||||
/* Check that the region is valid. */
|
||||
MESOSPHERE_ABORT_UNLESS(region->GetEndAddress() != 0);
|
||||
|
||||
/* Map the region. */
|
||||
R_TRY_CATCH(this->MapStatic(region->GetAddress(), region->GetSize(), perm)) {
|
||||
R_CONVERT(svc::ResultInvalidAddress, svc::ResultOutOfRange())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue