mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-17 18:26:53 +00:00
Use more bin.limit in bin.macho
This commit is contained in:
parent
39d5b0f9e5
commit
15cfe2925a
@ -3994,6 +3994,10 @@ static bool _load_relocations(struct MACH0_(obj_t) *mo) {
|
||||
if (amount < 0) {
|
||||
amount = 0;
|
||||
}
|
||||
const int bin_limit = mo->limit;
|
||||
if (bin_limit > 0 && amount > bin_limit) {
|
||||
amount = bin_limit;
|
||||
}
|
||||
for (j = 0; j < amount; j++) {
|
||||
struct reloc_t *reloc = R_NEW0 (struct reloc_t);
|
||||
if (!reloc) {
|
||||
|
@ -466,13 +466,24 @@ static RList* patch_relocs(RBinFile *bf) {
|
||||
}
|
||||
r_pvector_push (&ext_relocs, reloc);
|
||||
}
|
||||
if (mo->reloc_fixups && r_list_length (mo->reloc_fixups) > 0) {
|
||||
int relocs_count = r_list_length (mo->reloc_fixups);
|
||||
if (mo->reloc_fixups && relocs_count > 0) {
|
||||
ut8 buf[8], obuf[8];
|
||||
RBinReloc *r;
|
||||
RListIter *iter2;
|
||||
|
||||
int count = mo->limit;
|
||||
if (count == 0) {
|
||||
if (relocs_count > count) {
|
||||
R_LOG_WARN ("mo.limit for relocs");
|
||||
}
|
||||
count = relocs_count;
|
||||
}
|
||||
r_list_foreach (mo->reloc_fixups, iter2, r) {
|
||||
if (count-- < 0) {
|
||||
break;
|
||||
}
|
||||
ut64 paddr = r->paddr + mo->baddr;
|
||||
ut8 buf[8], obuf[8];
|
||||
r_write_ble64 (buf, r->vaddr, false);
|
||||
b->iob.read_at (b->iob.io, paddr, obuf, 8);
|
||||
if (memcmp (buf, obuf, 8)) {
|
||||
|
Loading…
Reference in New Issue
Block a user