Fix /c search due to changes on io

This commit is contained in:
alvarofe 2017-09-03 11:40:08 +02:00
parent ca123cd1de
commit 2bc8518a57
2 changed files with 14 additions and 8 deletions

View File

@ -101,9 +101,10 @@ R_API RList *r_core_asm_strsearch(RCore *core, const char *input, ut64 from, ut6
if (r_cons_is_breaked ()) {
break;
}
if (!r_io_read_at (core->io, at, buf, core->blocksize)) {
if (!r_io_is_valid_offset (core->io, at, 0)) {
break;
}
(void)r_io_read_at (core->io, at, buf, core->blocksize);
idx = 0, matchcount = 0;
while (addrbytes * (idx + 1) <= core->blocksize) {
ut64 addr = at + idx;

View File

@ -581,12 +581,22 @@ R_API RList *r_core_get_boundaries_prot(RCore *core, int protection, const char
SdbListIter *iter;
RIOMap *m;
*from = *to = 0;
list = r_list_newf (free);
list = r_list_newf ((RListFree)free);
if (!list) {
return NULL;
}
ls_foreach (core->io->maps, iter, m) {
RIOMap *map = R_NEW0 (RIOMap);
if (!*from) {
*from = map->from;
*to = map->to;
}
if ((m->from < *from) && m->from) {
*from = m->from;
}
if (m->to > *to) {
*to = m->to;
}
if (map) {
map->fd = m->fd;
map->from = m->from;
@ -1799,12 +1809,7 @@ static void do_asm_search(RCore *core, struct search_parameters *param, const ch
json = 0;
}
if (!strncmp (param->mode, "dbg.", 4) || !strncmp (param->mode, "io.sections", 11)) {
param->boundaries = r_core_get_boundaries (core, param->mode, &param->from, &param->to);
} else {
param->boundaries = NULL;
}
param->boundaries = r_core_get_boundaries (core, param->mode, &param->from, &param->to);
maxhits = (int) r_config_get_i (core->config, "search.count");
filter = (int) r_config_get_i (core->config, "asm.filter");