Fix more harmless asan oobreads in pdu and fc

This commit is contained in:
Sergi Àlvarez i Capilla 2022-02-14 01:31:22 +01:00 committed by pancake
parent a2b0bfa4eb
commit ed76d94144
2 changed files with 8 additions and 11 deletions

View File

@ -1283,7 +1283,7 @@ rep:
RFlagItem *fi;
r_list_foreach (list, iter, fi) {
if (fi->color) {
if (input[2] == '*') {
if (input[1] && input[2] == '*') {
r_cons_printf ("fc %s=%s\n", fi->name, fi->color);
} else {
const char *pad = r_str_pad (' ', 10- strlen (fi->name));
@ -1294,8 +1294,8 @@ rep:
} else if (input[1] == '-') {
RListIter *iter;
RFlagItem *fi;
ut64 addr = (input[2] != '*' && input[2]) ? r_num_math (core->num, input + 2): core->offset;
const RList *list = (input[2]=='*')?
ut64 addr = (input[1] && input[2] != '*' && input[2]) ? r_num_math (core->num, input + 2): core->offset;
const RList *list = (input[1] && input[2]=='*')?
r_flag_all_list (core->flags, false)
: r_flag_get_list (core->flags, addr);
r_list_foreach (list, iter, fi) {

View File

@ -1108,7 +1108,7 @@ static int cmd_pdu(RCore *core, const char *input) {
ut64 to;
ut64 count;
if (input[1] == '?' || input[2] == '?' || !arg) {
if (input[1] == '?' || (input[1] && input[2] == '?') || !arg) {
r_core_cmd_help_match (core, help_msg_pdu, "pdua", true);
break;
}
@ -1139,7 +1139,7 @@ static int cmd_pdu(RCore *core, const char *input) {
}
break;
case 'c': // "pduc"
if (input[1] == '?' || input[2] == '?') {
if (input[1] == '?' || (input[1] && input[2] == '?')) {
r_core_cmd_help_match (core, help_msg_pdu, "pduc", true);
break;
}
@ -1157,29 +1157,26 @@ static int cmd_pdu(RCore *core, const char *input) {
input[1] == 'j', NULL, NULL);
break;*/
case 'i': // "pdui"
if (input[1] == '?' || input[2] == '?' || !arg) {
if (input[1] == '?' || (input[1] && input[2] == '?') || !arg) {
r_core_cmd_help_match (core, help_msg_pdu, "pdui", true);
break;
}
ret = r_core_print_disasm (core, addr, buf, len, 0, instruction, arg, false,
input[1] == 'j', NULL, NULL);
break;
case 'o': // "pduo"
if (input[1] == '?' || input[2] == '?' || !arg) {
if (input[1] == '?' || (input[1] && input[2] == '?') || !arg) {
r_core_cmd_help_match (core, help_msg_pdu, "pduo", true);
break;
}
ret = r_core_print_disasm (core, addr, buf, len, 0, opcode, arg, false,
input[1] == 'j', NULL, NULL);
break;
case 's': // "pdus"
if (input[1] == '?' || input[2] == '?') {
if (input[1] == '?' || (input[1] && input[2] == '?')) {
r_core_cmd_help_match (core, help_msg_pdu, "pdus", true);
break;
}
ret = r_core_print_disasm (core, addr, buf, len, 0, instruction, "syscall", false,
input[1] == 'j', NULL, NULL);
break;