mirror of
https://github.com/radareorg/radare2.git
synced 2024-10-07 10:33:30 +00:00
Fixes in pZ, quoted commands and search
Fix pZ cache issue Fix parsing of quotes in quoted commands Fix segfault when searching invalid keywords
This commit is contained in:
parent
66b0c9b21a
commit
4819bd6304
@ -113,3 +113,4 @@ The '?' command can be used to evaluate math expressions. Like this: '? (0x34+22
|
||||
Use radare2! lemons included!
|
||||
Are you fucking coding me?
|
||||
rax2 -s 20e296b20ae296b220e296b20a
|
||||
Connection lost with the license server, your r2 session will terminate soon.
|
||||
|
@ -533,7 +533,7 @@ static int r_core_cmd_subst_i(RCore *core, char *cmd) {
|
||||
case '"':
|
||||
for (cmd++; *cmd; ) {
|
||||
ut64 oseek = UT64_MAX;
|
||||
char *p = find_eoq (cmd);
|
||||
char *line, *p = find_eoq (cmd);
|
||||
if (p) {
|
||||
*p = 0;
|
||||
if (p[1]=='@' || p[2]=='@') {
|
||||
@ -547,7 +547,10 @@ static int r_core_cmd_subst_i(RCore *core, char *cmd) {
|
||||
p = q;
|
||||
} else p = NULL;
|
||||
}
|
||||
r_cmd_call (core->cmd, cmd);
|
||||
line = strdup (cmd);
|
||||
line = r_str_replace (line, "\\\"", "\"", R_TRUE);
|
||||
r_cmd_call (core->cmd, line);
|
||||
free (line);
|
||||
if (oseek != UT64_MAX) {
|
||||
r_core_seek (core, oseek, 1);
|
||||
oseek = UT64_MAX;
|
||||
|
@ -472,7 +472,6 @@ return 0;
|
||||
}
|
||||
break;
|
||||
case 'Z':
|
||||
// TODO:0.9.2 zoom.byte changes does not take any effect
|
||||
if (input[1]=='?') {
|
||||
r_cons_printf (
|
||||
"Usage: pZ [len]\n"
|
||||
|
@ -353,9 +353,13 @@ static int cmd_search(void *data, const char *input) {
|
||||
{
|
||||
RSearchKeyword *skw;
|
||||
skw = r_search_keyword_new ((const ut8*)inp, len, NULL, 0, NULL);
|
||||
skw->icase = ignorecase;
|
||||
skw->type = R_SEARCH_KEYWORD_TYPE_STRING;
|
||||
r_search_kw_add (core->search, skw);
|
||||
if (skw) {
|
||||
skw->icase = ignorecase;
|
||||
skw->type = R_SEARCH_KEYWORD_TYPE_STRING;
|
||||
r_search_kw_add (core->search, skw);
|
||||
} else {
|
||||
eprintf ("Invalid keyword\n");
|
||||
}
|
||||
}
|
||||
r_search_begin (core->search);
|
||||
dosearch = R_TRUE;
|
||||
|
@ -461,6 +461,7 @@ R_API void r_print_progressbar(RPrint *p, int pc, int _cols) {
|
||||
|
||||
|
||||
R_API void r_print_zoom (RPrint *p, void *user, RPrintZoomCallback cb, ut64 from, ut64 to, int len, int maxlen) {
|
||||
static int mode = -1;
|
||||
ut8 *bufz, *bufz2;
|
||||
int i, j = 0;
|
||||
ut64 size = (to-from)/len;
|
||||
@ -469,11 +470,12 @@ R_API void r_print_zoom (RPrint *p, void *user, RPrintZoomCallback cb, ut64 from
|
||||
if (maxlen<2) maxlen = 1024*1024;
|
||||
if (size>maxlen) size = maxlen;
|
||||
if (size<1) size = 1;
|
||||
if (from == p->zoom->from && to == p->zoom->to && size==p->zoom->size) {
|
||||
if (mode == p->zoom->mode && from == p->zoom->from && to == p->zoom->to && size==p->zoom->size) {
|
||||
// get from cache
|
||||
bufz = p->zoom->buf;
|
||||
size = p->zoom->size;
|
||||
} else {
|
||||
mode = p->zoom->mode;
|
||||
bufz = (ut8 *) malloc (len);
|
||||
if (bufz == NULL) return;
|
||||
bufz2 = (ut8 *) malloc (size);
|
||||
|
@ -261,13 +261,10 @@ R_API RList *r_search_find(RSearch *s, ut64 addr, const ut8 *buf, int len) {
|
||||
|
||||
/* --- keywords --- */
|
||||
R_API int r_search_kw_add(RSearch *s, RSearchKeyword *kw) {
|
||||
int ret = R_FALSE;
|
||||
if (kw) {
|
||||
r_list_append (s->kws, kw);
|
||||
kw->kwidx = s->n_kws++;
|
||||
ret = R_TRUE;
|
||||
}
|
||||
return ret;
|
||||
if (!kw) return R_FALSE;
|
||||
r_list_append (s->kws, kw);
|
||||
kw->kwidx = s->n_kws++;
|
||||
return R_TRUE;
|
||||
}
|
||||
|
||||
R_API void r_search_kw_reset(RSearch *s) {
|
||||
|
Loading…
Reference in New Issue
Block a user