diff --git a/librz/core/cprint.c b/librz/core/cprint.c index 1a351a9144f..7193e079f7e 100644 --- a/librz/core/cprint.c +++ b/librz/core/cprint.c @@ -548,6 +548,7 @@ static void core_handle_call(RzCore *core, char *line, char **str) { static char *cons_disassembly(RzCore *core, ut64 addr, ut32 byte_len, ut32 inst_len) { rz_return_val_if_fail(core && (byte_len || inst_len), NULL); + // cbytes in disasm_options decides whether byte_len constrains inst_len bool cbytes = true; if (byte_len == 0) { @@ -555,6 +556,10 @@ static char *cons_disassembly(RzCore *core, ut64 addr, ut32 byte_len, ut32 inst_ byte_len = inst_len; } + if (inst_len == 0) { + inst_len = byte_len; + } + ut8 *block = malloc(byte_len + 1); if (!block) { RZ_LOG_ERROR("Cannot allocate buffer\n");