Revert "More misc cleanup"

This reverts commit 788a3b02c7.

	modifié :         libr/bin/format/pe/pe.c
This commit is contained in:
Maijin 2015-08-28 20:58:21 +02:00
parent 605290f071
commit 6831dd2f6d
7 changed files with 12 additions and 8 deletions

View File

@ -957,6 +957,8 @@ static RBinObject * r_bin_object_new (RBinFile *binfile, RBinPlugin *plugin, ut6
// only use LoadBytes if buffer offset != 0
//if (offset != 0 && bytes && plugin && plugin->load_bytes && (bytes_sz >= sz + offset) ) {
if (bytes && plugin && plugin->load_bytes && (bytes_sz >= sz + offset) ) {
ut64 bsz = bytes_sz - offset;
if (sz<bsz) bsz = sz;
o->bin_obj = plugin->load_bytes (binfile, bytes+offset, sz, loadaddr, sdb);
if (!o->bin_obj) {
eprintf("Error in r_bin_object_new: load_bytes failed for %s plugin\n",

View File

@ -1325,7 +1325,7 @@ static struct r_bin_elf_symbol_t* get_symbols_from_phdr (struct Elf_(r_bin_elf_o
Elf_(Sym) *sym = NULL;
Elf_(Addr) addr_sym_table = 0;
struct r_bin_elf_symbol_t *ret = NULL;
int j, k, r, tsize, nsym, ret_ctr;
int j, k, r, tsize, len, nsym, ret_ctr;
ut64 toffset;
ut32 size;
@ -1403,9 +1403,10 @@ static struct r_bin_elf_symbol_t* get_symbols_from_phdr (struct Elf_(r_bin_elf_o
int st_name = sym[k].st_name;
int maxsize = R_MIN (bin->size, bin->strtab_size);
if (st_name < 0 || st_name >= maxsize) {
len = 0;
ret[ret_ctr].name[0] = 0;
} else {
int len = __strnlen (bin->strtab+st_name, rest);
len = __strnlen (bin->strtab+st_name, rest);
memcpy (ret[ret_ctr].name, &bin->strtab[st_name], len);
}
}

View File

@ -1982,6 +1982,7 @@ struct r_bin_pe_import_t* PE_(r_bin_pe_get_imports)(struct PE_(r_bin_pe_obj_t) *
curr_import_dir->FirstThunk != 0 || curr_import_dir->Name != 0 ||
curr_import_dir->TimeDateStamp != 0 || curr_import_dir->Characteristics != 0 ||
curr_import_dir->ForwarderChain != 0)) {
dll_name_offset = curr_import_dir->Name;
int rr = r_buf_read_at (bin->b,
bin_pe_vaddr_to_paddr(bin, dll_name_offset),
(ut8*)dll_name, PE_NAME_LENGTH);

View File

@ -1186,8 +1186,7 @@ R_API int r_core_block_size(RCore *core, int bsize) {
eprintf ("bsize is bigger than `bm`. dimmed to 0x%x > 0x%x\n",
bsize, core->blocksize_max);
bsize = core->blocksize_max;
}
} else ret = R_TRUE;
bump = realloc (core->block, bsize+1);
if (bump == NULL) {
eprintf ("Oops. cannot allocate that much (%u)\n", bsize);

View File

@ -1053,7 +1053,8 @@ R_API int r_core_visual_cmd(RCore *core, int ch) {
} else r_core_seek (core, 0, 1);
r_io_sundo_push (core->io, core->offset);
break;
case 'G':{
case 'G':
ret = 0;
int scols = r_config_get_i (core->config, "hex.cols");
if (core->file) {
if (core->io->va) {
@ -1080,7 +1081,6 @@ R_API int r_core_visual_cmd(RCore *core, int ch) {
if (ret != -1)
r_io_sundo_push (core->io, core->offset);
break;
}
case 'h':
if (curset) {
cursor--;

View File

@ -553,6 +553,7 @@ R_API int r_core_visual_comments (RCore *core) {
for (;;) {
r_cons_clear00 ();
r_cons_strcat ("Comments:\n");
i = 0;
found = 0;
#undef DB
#define DB core->anal->sdb_meta

View File

@ -1541,13 +1541,13 @@ R_API char *r_str_utf16_encode (const char *s, int len) {
// TODO: merge print inside rutil
/* hack from print */
R_API int r_print_format_length (const char *fmt) {
int nargs, i, idx, times, endian;
int nargs, i, j, idx, times, endian;
char *args, *bracket, tmp, last = 0;
const char *arg = fmt;
const char *argend = arg+strlen (fmt);
char namefmt[8];
int viewflags = 0;
endian = 0;
nargs = endian = i = j = 0;
while (*arg && iswhitechar (*arg)) arg++;
/* get times */