Trimming down the disasm to fix an oobread in VV

$ r2 -NAAc 'e asm.pseudo=1;s 0x000c7dd0;VV'  classes.dex > /dev/null
This commit is contained in:
pancake 2019-08-06 16:01:52 -07:00
parent 7323e6ac11
commit 1dfbedc545
2 changed files with 4 additions and 7 deletions

View File

@ -933,13 +933,9 @@ static char *colorize_asm_string(RCore *core, RDisasmState *ds, bool print_color
if (!scol2) {
scol2 = strdup ("");
}
source = malloc (strlen (scol1) + strlen (scol2) + 2 + 1); // reuse source variable
if (source) {
sprintf (source, "%s||%s", scol1, scol2);
free (scol1);
free (scol2);
}
source = r_str_newf ("%s||%s", scol1, scol2);
free (scol1);
free (scol2);
return source;
}
return r_print_colorize_opcode (ds->core->print, source, ds->color_reg, ds->color_num, partial_reset, f ? f->addr : 0);

View File

@ -1997,6 +1997,7 @@ R_API char* r_print_colorize_opcode(RPrint *print, char *p, const char *reg, con
if (is_jmp) {
return strdup (p);
}
r_str_trim_head_tail (p);
if (opcode_sz > COLORIZE_BUFSIZE) {
/* return same string in case of error */
return strdup (p);