Fix #476 - pr `.` segfaults (control tailcall depth)
This commit is contained in:
parent
f29cbb5ad6
commit
f1114fa600
|
@ -188,3 +188,4 @@ bitch
|
|||
I nodejs so hard my exams
|
||||
What a nodejs!
|
||||
Now featuring NoSQL!
|
||||
Kentucky Fried Children
|
||||
|
|
|
@ -1471,6 +1471,11 @@ R_API int r_core_cmd(RCore *core, const char *cstr, int log) {
|
|||
|
||||
if (log) r_line_hist_add (cstr);
|
||||
|
||||
if (core->cmd_depth<1) {
|
||||
eprintf ("r_core_cmd: That was too deep...\n");
|
||||
return 0;
|
||||
}
|
||||
core->cmd_depth --;
|
||||
for (rcmd = cmd;;) {
|
||||
ptr = strstr (rcmd, "\n");
|
||||
if (ptr) *ptr = '\0';
|
||||
|
@ -1482,6 +1487,7 @@ R_API int r_core_cmd(RCore *core, const char *cstr, int log) {
|
|||
if (!ptr) break;
|
||||
rcmd = ptr+1;
|
||||
}
|
||||
core->cmd_depth ++;
|
||||
|
||||
free (ocmd);
|
||||
free (core->oobi);
|
||||
|
|
|
@ -325,6 +325,12 @@ static int cb_fsview(void *user, void *data) {
|
|||
return R_TRUE;
|
||||
}
|
||||
|
||||
static int cb_cmddepth(void *user, void *data) {
|
||||
int c = R_MAX (((RConfigNode*)data)->i_value, 0);
|
||||
((RCore *)user)->cmd_depth = c;
|
||||
return R_TRUE;
|
||||
}
|
||||
|
||||
static int cb_hexcols(void *user, void *data) {
|
||||
int c = R_MIN (128, R_MAX (((RConfigNode*)data)->i_value, 0));
|
||||
((RCore *)user)->print->cols = c & ~1;
|
||||
|
@ -681,6 +687,7 @@ R_API int r_core_config_init(RCore *core) {
|
|||
else
|
||||
r_config_set (cfg, "cmd.graph", "?e cannot find a valid picture viewer");
|
||||
r_config_desc (cfg, "cmd.graph", "Command executed by 'agv' command to view graphs");
|
||||
SETICB("cmd.depth", 10, &cb_cmddepth, "Maximum command depth");
|
||||
SETPREF("cmd.bp", "", "Command to executed every breakpoint hit");
|
||||
SETPREF("cmd.cprompt", "", "Column visual prompt commands");
|
||||
SETPREF("cmd.hit", "", "Command to execute on every search hit");
|
||||
|
|
|
@ -459,6 +459,7 @@ static int __disasm(void *_core, ut64 addr) {
|
|||
|
||||
R_API int r_core_init(RCore *core) {
|
||||
static int singleton = R_TRUE;
|
||||
core->cmd_depth = 10;
|
||||
core->config = NULL;
|
||||
core->print = r_print_new ();
|
||||
core->http_up = R_FALSE;
|
||||
|
|
|
@ -143,6 +143,7 @@ typedef struct r_core_t {
|
|||
int vseek;
|
||||
RList *watchers;
|
||||
RList *scriptstack;
|
||||
int cmd_depth;
|
||||
} RCore;
|
||||
|
||||
typedef struct r_core_cmpwatch_t {
|
||||
|
|
Loading…
Reference in New Issue