1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-10 06:01:52 +00:00

Fix NRO patch offset application

This commit is contained in:
Michael Scire 2019-04-23 08:31:11 -07:00
parent 13c825a8bb
commit 8313669716

View file

@ -107,7 +107,6 @@ static void ApplyIpsPatch(u8 *mapped_nro, size_t mapped_size, bool is_ips32, FIL
} }
} else { } else {
IPS_RLE_PATCH_OFFSET_WITHIN_BOUNDS: IPS_RLE_PATCH_OFFSET_WITHIN_BOUNDS:
patch_offset -= sizeof(Registration::NroHeader);
if (patch_offset + rle_size > mapped_size) { if (patch_offset + rle_size > mapped_size) {
rle_size = mapped_size - patch_offset; rle_size = mapped_size - patch_offset;
} }
@ -126,7 +125,6 @@ static void ApplyIpsPatch(u8 *mapped_nro, size_t mapped_size, bool is_ips32, FIL
} }
} else { } else {
IPS_DATA_PATCH_OFFSET_WITHIN_BOUNDS: IPS_DATA_PATCH_OFFSET_WITHIN_BOUNDS:
patch_offset -= sizeof(Registration::NroHeader);
u32 read_size = patch_size; u32 read_size = patch_size;
if (patch_offset + read_size > mapped_size) { if (patch_offset + read_size > mapped_size) {
read_size = mapped_size - patch_offset; read_size = mapped_size - patch_offset;