mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-04 19:47:31 +00:00
Fix #2841 - Fix some near-infinite loops in sandbox mode
This commit is contained in:
parent
6dc29e516a
commit
e3e39a806e
@ -1414,7 +1414,12 @@ static void do_string_search(RCore *core, struct search_parameters *param) {
|
||||
if (!json) {
|
||||
eprintf ("# %d [0x%"PFMT64x"-0x%"PFMT64x"]\n", fd, param->from, param->to);
|
||||
}
|
||||
|
||||
if (r_sandbox_enable (0)) {
|
||||
if ((param->to - param->from) > 1024*64) {
|
||||
eprintf ("Sandbox restricts search range\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (param->bckwrds) {
|
||||
if (param->to < param->from + bufsz) {
|
||||
at = param->from;
|
||||
@ -2107,7 +2112,7 @@ static int cmd_search(void *data, const char *input) {
|
||||
searchhits = 0;
|
||||
r_config_set_i (core->config, "search.kwidx", core->search->n_kws);
|
||||
if (dosearch)
|
||||
do_string_search(core, ¶m);
|
||||
do_string_search (core, ¶m);
|
||||
beach:
|
||||
core->num->value = searchhits;
|
||||
core->in_search = R_FALSE;
|
||||
|
@ -1092,9 +1092,17 @@ R_API int r_core_prompt_exec(RCore *r) {
|
||||
R_API int r_core_block_size(RCore *core, int bsize) {
|
||||
ut8 *bump;
|
||||
int ret = R_FALSE;
|
||||
if (bsize<0) return R_FALSE;
|
||||
if (bsize == core->blocksize)
|
||||
return R_TRUE;
|
||||
if (bsize<0 || bsize > core->blocksize_max) {
|
||||
if (r_sandbox_enable (0)) {
|
||||
// TODO : restrict to filesize?
|
||||
if (bsize > 1024*32) {
|
||||
eprintf ("Sandbox mode restricts blocksize bigger than 32k\n");
|
||||
return R_FALSE;
|
||||
}
|
||||
}
|
||||
if (bsize > core->blocksize_max) {
|
||||
eprintf ("Block size %d is too big\n", bsize);
|
||||
return R_FALSE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user