Skip to content

Commit

Permalink
Fix radareorg#14779 - Check number errors when parsing @@= args ##shell
Browse files Browse the repository at this point in the history
  • Loading branch information
radare authored and trufae committed Dec 11, 2024
1 parent 091bb12 commit 7856980
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion libr/core/cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -5376,8 +5376,12 @@ static void foreach_pairs(RCore *core, const char *cmd, const char *each) {
if (next) {
*next = 0;
}
if (arg && *arg) {
if (R_STR_ISNOTEMPTY (arg)) {
ut64 n = r_num_get (NULL, arg);
if (core->num->nc.errors != 0) {
R_LOG_ERROR ("Invalid number '%s'", arg);
break;
}
if (pair % 2) {
r_core_block_size (core, n);
r_core_cmd0 (core, cmd);
Expand Down Expand Up @@ -5806,13 +5810,21 @@ static void cmd_foreach_offset(RCore *core, const char *_cmd, const char *each)
if (str) {
*str = '\0';
addr = r_num_math (core->num, each);
if (core->num->nc.errors != 0) {
R_LOG_ERROR ("Invalid number '%s'", each);
break;
}
*str = ' ';
each = str + 1;
} else {
if (!*each) {
break;
}
addr = r_num_math (core->num, each);
if (core->num->nc.errors != 0) {
R_LOG_ERROR ("Invalid number '%s'", each);
break;
}
each = NULL;
}
r_core_seek (core, addr, true);
Expand Down

0 comments on commit 7856980

Please sign in to comment.