mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-22 20:06:40 +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. */
|
/* Apply patch. */
|
||||||
if (patch_offset + rle_size > mapped_size) {
|
if (patch_offset + rle_size > mapped_size) {
|
||||||
|
AMS_ABORT_UNLESS(patch_offset <= mapped_size);
|
||||||
rle_size = mapped_size - patch_offset;
|
rle_size = mapped_size - patch_offset;
|
||||||
}
|
}
|
||||||
std::memset(mapped_module + patch_offset, buffer[0], rle_size);
|
std::memset(mapped_module + patch_offset, buffer[0], rle_size);
|
||||||
|
@ -190,6 +191,7 @@ namespace ams::patcher {
|
||||||
/* Apply patch. */
|
/* Apply patch. */
|
||||||
u32 read_size = patch_size;
|
u32 read_size = patch_size;
|
||||||
if (patch_offset + read_size > mapped_size) {
|
if (patch_offset + read_size > mapped_size) {
|
||||||
|
AMS_ABORT_UNLESS(patch_offset <= mapped_size);
|
||||||
read_size = mapped_size - patch_offset;
|
read_size = mapped_size - patch_offset;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue