fix bug that failed to do PE relocs when built as 32bit binary

previously void pointer has been used as user arg with callback
to fix relocations - that worked when built in 64bit mode but produced
incorrect values when built in 32bit mode, making the exploit always
crash the target phone instead of succeeding

so this change now references proper 64bit value with the arg instead
This commit is contained in:
j4nn 2026-01-17 12:23:20 +01:00
commit 9cf3397ef6

View file

@ -49,7 +49,7 @@ static uint8_t *image_buff;
static int fix_relocs(void *N, const VA &relocAddr, const reloc_type &type)
{
uint64_t *ptr;
uint64_t newbase = reinterpret_cast<uint64_t>(N);
uint64_t newbase = *static_cast<uint64_t *>(N);
if (type == RELOC_ABSOLUTE)
return 0;
@ -141,7 +141,7 @@ int load_pe(const char *fname, void *buff, int maxsize, uint64_t base_va,
for (i = 0; va < va_end; va++, i++)
ReadByteAtVA(p, va, image_buff[i]);
IterRelocs(p, fix_relocs, (void *)base_va);
IterRelocs(p, fix_relocs, &base_va);
if (code_boundary != NULL) {
*code_boundary = 0;