fix crash in r2 -A

crowell: http://jjdredd.github.io/petka2.exe
crowell: http://jjdredd.github.io/petka.bt.txt
This commit is contained in:
Jeffrey Crowell 2016-02-24 00:41:36 -05:00
parent a1088bdbf9
commit a70caf7160

View File

@ -60,9 +60,15 @@ static RAnalVar *get_used_var(RAnal *anal, RAnalOp *op) {
char *inst_key = sdb_fmt (0, "inst.0x%"PFMT64x".vars", op->addr);
char *var_def = sdb_get (anal->sdb_fcns, inst_key, 0);
struct VarUsedType vut;
int fmt_len, i, ct = 0;
RAnalVar *res;
if (!var_def) return NULL;
// ensure that var_def is properly formatted.
for (i = 0; i < strlen (var_def); ++i) {
if (var_def == ',') ++ct;
}
if (ct != 2) return NULL;
sdb_fmt_tobin (var_def, SDB_VARUSED_FMT, &vut);
res = r_anal_var_get (anal, vut.fcn_addr, vut.type[0], vut.scope, vut.delta);
sdb_fmt_free (&vut, SDB_VARUSED_FMT);