Skip to content

Commit

Permalink
Few minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sivaramaaa authored and Anton Kochkov committed Jul 12, 2018
1 parent 506144d commit 93d9120
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions libr/core/anal_tp.c
Expand Up @@ -159,6 +159,7 @@ static ut64 get_addr (Sdb *trace, const char *regname, int idx) {
}

#define DEFAULT_MAX 3
#define REG_SZ 10

static void type_match(RCore *core, ut64 addr, char *fcn_name, ut64 faddr, const char* cc,
int prev_idx, bool userfnc, ut64 caddr) {
Expand Down Expand Up @@ -195,7 +196,7 @@ static void type_match(RCore *core, ut64 addr, char *fcn_name, ut64 faddr, const
if (!in_stack) {
place = r_anal_cc_arg (anal, cc, arg_num + 1);
}
char regname[10] = {0};
char regname[REG_SZ] = {0};
ut64 xaddr = UT64_MAX;
bool memref = false;
bool cmt_set = false;
Expand Down Expand Up @@ -268,7 +269,7 @@ static void type_match(RCore *core, ut64 addr, char *fcn_name, ut64 faddr, const
}
}
} else if (var && res && (xaddr != UT64_MAX)) { // Type progation using value
char tmp[10] = {0};
char tmp[REG_SZ] = {0};
get_src_regname (core, instr_addr, tmp, sizeof (tmp));
ut64 ptr = get_addr (trace, tmp, j);
if (ptr == xaddr) {
Expand Down Expand Up @@ -395,7 +396,7 @@ R_API void r_core_anal_type_match(RCore *core, RAnalFunction *fcn) {
bool sign = false;
// Forward propgation of function return type
if (!resolved && ret_type && ret_reg) {
char tmp[10] = {0};
char tmp[REG_SZ] = {0};
get_src_regname (core, aop.addr, tmp, sizeof (tmp));
if ((type == R_ANAL_OP_TYPE_MOV) && *tmp && !strcmp (tmp, ret_reg) && var) {
var_retype (anal, var, NULL, ret_type, addr, false, false);
Expand All @@ -421,7 +422,7 @@ R_API void r_core_anal_type_match(RCore *core, RAnalFunction *fcn) {
// lea rax , str.hello ; mov [local_ch], rax;
if (prop && (type == R_ANAL_OP_TYPE_MOV)) {
char *vtype = str_flag ? "const char *": prev_type;
char reg[10] = {0};
char reg[REG_SZ] = {0};
bool match = false;
get_src_regname (core, addr, reg, sizeof (reg));
char *tmp = strchr (reg , ',');
Expand Down

0 comments on commit 93d9120

Please sign in to comment.