mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-03 02:41:08 +00:00
* Fix segfault in 'wa' (thanks ash for reporting!)
This commit is contained in:
parent
64acd4eeae
commit
f74a844ed3
@ -1580,17 +1580,19 @@ static int cmd_write(void *data, const char *input) {
|
||||
break;
|
||||
case 'a':
|
||||
{
|
||||
struct r_asm_code_t *acode;
|
||||
RAsmCode *acode;
|
||||
/* XXX ULTRAUGLY , needs fallback support in rasm */
|
||||
r_asm_use (&core->assembler, "x86.olly");
|
||||
r_asm_set_pc (&core->assembler, core->offset);
|
||||
if (input[1]==' ') input=input+1;
|
||||
acode = r_asm_massemble (&core->assembler, input+1);
|
||||
eprintf ("Written %d bytes (%s)=wx %s\n", acode->len, input+1, acode->buf_hex);
|
||||
r_core_write_at (core, core->offset, acode->buf, acode->len);
|
||||
r_asm_code_free (acode);
|
||||
r_core_block_read (core, 0);
|
||||
r_asm_use (&core->assembler, "x86"); /* XXX */
|
||||
if (acode) {
|
||||
eprintf ("Written %d bytes (%s)=wx %s\n", acode->len, input+1, acode->buf_hex);
|
||||
r_core_write_at (core, core->offset, acode->buf, acode->len);
|
||||
r_asm_code_free (acode);
|
||||
r_core_block_read (core, 0);
|
||||
r_asm_use (&core->assembler, "x86"); /* XXX */
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'b':
|
||||
|
@ -465,17 +465,17 @@ R_API int r_core_visual_cmd(RCore *core, int ch) {
|
||||
r_print_set_flags (&core->print, flags);
|
||||
break;
|
||||
case 'a':
|
||||
r_cons_printf("Enter assembler opcodes separated with ';':\n");
|
||||
r_cons_flush();
|
||||
r_cons_set_raw (0);
|
||||
r_cons_printf ("Enter assembler opcodes separated with ';':\n");
|
||||
r_cons_flush ();
|
||||
r_cons_set_raw (R_FALSE);
|
||||
strcpy (buf, "wa ");
|
||||
if (r_cons_fgets (buf+3, 1000, 0, NULL) <0) buf[0]='\0';
|
||||
if (buf[0]) {
|
||||
if (curset) r_core_seek(core, core->offset + cursor, 0);
|
||||
r_core_cmd(core, buf, 1);
|
||||
if (curset) r_core_seek(core, core->offset - cursor, 1);
|
||||
if (curset) r_core_seek (core, core->offset + cursor, 0);
|
||||
r_core_cmd (core, buf, R_TRUE);
|
||||
if (curset) r_core_seek (core, core->offset - cursor, 1);
|
||||
}
|
||||
r_cons_set_raw(1);
|
||||
r_cons_set_raw (R_TRUE);
|
||||
break;
|
||||
case 'w':
|
||||
r_cons_printf ("Enter hexpair string to write:\n");
|
||||
|
Loading…
Reference in New Issue
Block a user