mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-12-22 12:21:18 +00:00
loader/ro: abort if patching would go out of bounds
This commit is contained in:
parent
db3dc4ebd2
commit
1fa41c3e2a
1 changed files with 2 additions and 0 deletions
|
@ -167,6 +167,7 @@ namespace ams::patcher {
|
|||
|
||||
/* Apply patch. */
|
||||
if (patch_offset + rle_size > mapped_size) {
|
||||
AMS_ABORT_UNLESS(patch_offset <= mapped_size);
|
||||
rle_size = mapped_size - patch_offset;
|
||||
}
|
||||
std::memset(mapped_module + patch_offset, buffer[0], rle_size);
|
||||
|
@ -190,6 +191,7 @@ namespace ams::patcher {
|
|||
/* Apply patch. */
|
||||
u32 read_size = patch_size;
|
||||
if (patch_offset + read_size > mapped_size) {
|
||||
AMS_ABORT_UNLESS(patch_offset <= mapped_size);
|
||||
read_size = mapped_size - patch_offset;
|
||||
}
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue