* Fix segfault parsing imports in mach-o

* Simplify the output of the command 'S'
* Update TODO
This commit is contained in:
Nibble 2010-07-11 13:15:18 +02:00
parent 1fd4f51f66
commit 89a63b5c3a
5 changed files with 10 additions and 6 deletions

1
TODO
View File

@ -12,7 +12,6 @@
Questions:
----------
* #md5 #sha1 #entropy ...
* vsize=>vs, vaddr=>va, size=>sz ??? in 'S' command
* There's dup of info between RMeta and RAnal .. functions.. oh fuck!
* imports from PE doesnt works with /a because there's an indirect call
* rabin2 doesnt works for osx-x86 mach0 bins..so io.va=1 fails

View File

@ -431,13 +431,18 @@ struct r_bin_mach0_import_t* MACH0_(r_bin_mach0_get_imports)(struct MACH0_(r_bin
memcpy(sectname, bin->sects[i].sectname, 16);
if ((bin->sects[i].flags & S_SYMBOL_STUBS) && bin->sects[i].reserved2 != 0) {
nsyms = (int)(bin->sects[i].size / bin->sects[i].reserved2);
for (j = 0; j < nsyms; j++, k++) {
for (j = 0; j < nsyms; j++) {
if (bin->sects[i].reserved1 + j >= bin->nindirectsyms)
continue;
sym = bin->indirectsyms[bin->sects[i].reserved1 + j];
if (sym >= bin->nsymtab)
continue;
imports[k].offset = bin->sects[i].offset + j * bin->sects[i].reserved2;
imports[k].addr = bin->sects[i].addr + j * bin->sects[i].reserved2;
snprintf (imports[k].name, R_BIN_MACH0_STRING_LENGTH, "%s:%s",
sectname, (char*)bin->symstr+bin->symtab[sym].n_un.n_strx);
imports[k].last = 0;
k++;
}
}
}

View File

@ -13,7 +13,7 @@
#define MACH0_(name) name
#define MH_MAGIC 0xfeedface
#define MH_CIGAM 0xcefaedfe
#define FAT_CIGAM 0xbebafeca
#define FAT_CIGAM 0xcafebabe
#endif
#ifndef _INCLUDE_MACHO_SPECS_H_

View File

@ -67,7 +67,6 @@ static void r_core_anal_graph_nodes(RCore *core, RList *pbb, ut64 addr, int opts
RListIter *iter;
char *str;
// TODO: display nodes in yellow when those are traced ones
/* In partial graphs test if the bb is already printed */
if (pbb)
r_list_foreach (pbb, iter, bbi)
@ -106,7 +105,8 @@ static void r_core_anal_graph_nodes(RCore *core, RList *pbb, ut64 addr, int opts
bbi->diff==R_ANAL_DIFF_MATCH?"green":
bbi->diff==R_ANAL_DIFF_UNMATCH?"red":"lightgray",str);
} else {
r_cons_printf (" \"0x%08"PFMT64x"\" [label=\"%s\"]\n", bbi->addr, str);
r_cons_printf (" \"0x%08"PFMT64x"\" [color=%s,label=\"%s\"]\n", bbi->addr,
bbi->traced?"yellow":"lightgray",str);
}
r_cons_flush ();
free (str);

View File

@ -54,7 +54,7 @@ R_API void r_io_section_list(RIO *io, ut64 offset, int rad) {
ut64 ptr = (s->vaddr>=offset)?s->vaddr:s->offset;
if (rad) io->printf ("S 0x%08"PFMT64x" 0x%08"PFMT64x" 0x%08"PFMT64x" 0x%08"PFMT64x" %s %d\n",
s->offset, s->vaddr, s->size, s->vsize, s->name, s->rwx);
else io->printf ("[%02d] %c 0x%08"PFMT64x" %s vaddr=0x%08"PFMT64x" size=0x%08"PFMT64x" vsize=%08"PFMT64x" %s\n",
else io->printf ("[%02d] %c 0x%08"PFMT64x" %s va=0x%08"PFMT64x" sz=0x%08"PFMT64x" vsz=%08"PFMT64x" %s\n",
i, (offset>=ptr && offset<ptr+s->size)?'*':'.',
s->offset, r_str_rwx_i (s->rwx), s->vaddr, s->size, s->vsize, s->name);
i++;