Avoid null bytes in axt output

This commit is contained in:
pancake 2016-02-09 11:38:55 -06:00
parent 80edc616c7
commit 9f2ce614d3
4 changed files with 19 additions and 14 deletions

View File

@ -1142,7 +1142,7 @@ static int esil_diveq(RAnalEsil *esil) {
eprintf ("esil_diveq: empty stack\n"); eprintf ("esil_diveq: empty stack\n");
} }
} else { } else {
eprintf ("esil_diveq: invalid parameters"); eprintf ("0x08%"PFMT64x" esil_diveq: invalid parameters\n", esil->address);
} }
free (src); free (src);
free (dst); free (dst);
@ -1162,7 +1162,7 @@ static int esil_mul(RAnalEsil *esil) {
eprintf ("esil_mul: empty stack\n"); eprintf ("esil_mul: empty stack\n");
} }
} else { } else {
eprintf ("esil_mul: invalid parameters"); eprintf ("esil_mul: invalid parameters\n");
} }
free (src); free (src);
free (dst); free (dst);
@ -1290,7 +1290,7 @@ static int esil_sub(RAnalEsil *esil) {
r_anal_esil_pushnum (esil, d-s); r_anal_esil_pushnum (esil, d-s);
ret = true; ret = true;
} else { } else {
eprintf ("esil_sub: invalid parameters"); eprintf ("esil_sub: invalid parameters\n");
} }
} else { } else {
eprintf ("esil_sub: invalid parameters\n"); eprintf ("esil_sub: invalid parameters\n");

View File

@ -10,7 +10,7 @@
// serializes with sdb_native // serializes with sdb_native
R_API RAnalRef *r_anal_ref_new() { R_API RAnalRef *r_anal_ref_new() {
RAnalRef *ref = R_NEW (RAnalRef); RAnalRef *ref = R_NEW0 (RAnalRef);
if (ref) { if (ref) {
ref->addr = -1; ref->addr = -1;
ref->at = -1; ref->at = -1;
@ -35,6 +35,17 @@ R_API int r_anal_ref_add(RAnal *anal, ut64 addr, ut64 at, int type) {
return true; return true;
} }
R_API const char *r_anal_ref_to_string(RAnal *anal, int type) {
switch (type) {
case R_ANAL_REF_TYPE_NULL: return "null";
case R_ANAL_REF_TYPE_CODE: return "code";
case R_ANAL_REF_TYPE_CALL: return "call";
case R_ANAL_REF_TYPE_DATA: return "data";
case R_ANAL_REF_TYPE_STRING: return "strg";
}
return "unk";
}
R_API int r_anal_ref_del(RAnal *anal, ut64 from, ut64 to) { R_API int r_anal_ref_del(RAnal *anal, ut64 from, ut64 to) {
r_anal_xrefs_deln (anal, R_ANAL_REF_TYPE_NULL, from, to); r_anal_xrefs_deln (anal, R_ANAL_REF_TYPE_NULL, from, to);
r_anal_xrefs_deln (anal, R_ANAL_REF_TYPE_CODE, from, to); r_anal_xrefs_deln (anal, R_ANAL_REF_TYPE_CODE, from, to);

View File

@ -2685,8 +2685,9 @@ static bool cmd_anal_refs(RCore *core, const char *input) {
} else { } else {
buf_fcn = r_str_newf ("%s", fcn ? fcn->name : "unknown function"); buf_fcn = r_str_newf ("%s", fcn ? fcn->name : "unknown function");
} }
r_cons_printf ("%c 0x%" PFMT64x " %s in %s\n", r_cons_printf ("%s 0x%" PFMT64x " %s in %s\n",
ref->type, ref->addr, buf_asm, buf_fcn); r_anal_ref_to_string (core->anal, ref->type),
ref->addr, buf_asm, buf_fcn);
free (buf_asm); free (buf_asm);
free (buf_fcn); free (buf_fcn);
} }

View File

@ -771,14 +771,6 @@ typedef struct r_anal_var_t {
RList/*RAnalValue*/ *stores; /* where this */ RList/*RAnalValue*/ *stores; /* where this */
} RAnalVar; } RAnalVar;
/*
typedef struct r_anal_var_type_t {
char *name;
char *fmt;
ut32 size;
} RAnalVarType;
*/
typedef enum { typedef enum {
R_ANAL_REF_TYPE_NULL = 0, R_ANAL_REF_TYPE_NULL = 0,
R_ANAL_REF_TYPE_CODE = 'c', // code ref R_ANAL_REF_TYPE_CODE = 'c', // code ref
@ -1313,6 +1305,7 @@ R_API RList* r_anal_get_fcns (RAnal *anal);
R_API RAnalRef *r_anal_ref_new(void); R_API RAnalRef *r_anal_ref_new(void);
R_API RList *r_anal_ref_list_new(void); R_API RList *r_anal_ref_list_new(void);
R_API void r_anal_ref_free(void *ref); R_API void r_anal_ref_free(void *ref);
R_API const char *r_anal_ref_to_string(RAnal *anal, int type);
R_API int r_anal_ref_add(RAnal *anal, ut64 addr, ut64 at, int type); R_API int r_anal_ref_add(RAnal *anal, ut64 addr, ut64 at, int type);
R_API int r_anal_ref_del(RAnal *anal, ut64 at, ut64 addr); R_API int r_anal_ref_del(RAnal *anal, ut64 at, ut64 addr);
R_API RList *r_anal_xref_get(RAnal *anal, ut64 addr); R_API RList *r_anal_xref_get(RAnal *anal, ut64 addr);