mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-23 21:29:49 +00:00
Fix null deref assert in pdj ##crash
This commit is contained in:
parent
ac752dd4f0
commit
969fa6e3f6
@ -20,9 +20,9 @@ R_LIB_VERSION (r_bin);
|
||||
#define R_BIN_LDR_STATIC_PLUGINS 0
|
||||
#endif
|
||||
|
||||
static const RBinPlugin *bin_static_plugins[] = { R_BIN_STATIC_PLUGINS, NULL };
|
||||
static const RBinXtrPlugin *bin_xtr_static_plugins[] = { R_BIN_XTR_STATIC_PLUGINS, NULL };
|
||||
static const RBinLdrPlugin *bin_ldr_static_plugins[] = { R_BIN_LDR_STATIC_PLUGINS, NULL };
|
||||
static RBinPlugin *bin_static_plugins[] = { R_BIN_STATIC_PLUGINS, NULL };
|
||||
static RBinXtrPlugin *bin_xtr_static_plugins[] = { R_BIN_XTR_STATIC_PLUGINS, NULL };
|
||||
static RBinLdrPlugin *bin_ldr_static_plugins[] = { R_BIN_LDR_STATIC_PLUGINS, NULL };
|
||||
|
||||
static int __getoffset(RBin *bin, int type, int idx) {
|
||||
RBinFile *a = r_bin_cur (bin);
|
||||
|
@ -6841,18 +6841,20 @@ R_API int r_core_print_disasm_json(RCore *core, ut64 addr, ut8 *buf, int nb_byte
|
||||
}
|
||||
ret = r_asm_disassemble (core->rasm, &asmop, buf + i, nb_bytes - i);
|
||||
if (ret < 1) {
|
||||
char *hex = r_asm_op_get_hex (&asmop);
|
||||
pj_o (pj);
|
||||
pj_kn (pj, "offset", at);
|
||||
pj_ki (pj, "size", 1);
|
||||
pj_ks (pj, "bytes", hex);
|
||||
if (asmop.bytes) {
|
||||
char *hex = r_asm_op_get_hex (&asmop);
|
||||
pj_ks (pj, "bytes", hex);
|
||||
free (hex);
|
||||
}
|
||||
pj_ks (pj, "type", "invalid");
|
||||
pj_end (pj);
|
||||
i++;
|
||||
k++;
|
||||
j++;
|
||||
result = true;
|
||||
free (hex);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -364,11 +364,11 @@ R_API int r_hex_pair2bin(const char *arg) {
|
||||
}
|
||||
|
||||
R_API int r_hex_bin2str(const ut8 *in, int len, char *out) {
|
||||
int i, idx;
|
||||
char tmp[8];
|
||||
if (len < 0) {
|
||||
if (!in || len < 0) {
|
||||
return 0;
|
||||
}
|
||||
int i, idx;
|
||||
char tmp[8];
|
||||
for (idx = i = 0; i < len; i++, idx += 2) {
|
||||
r_hex_from_byte (tmp, in[i]);
|
||||
memcpy (out + idx, tmp, 2);
|
||||
|
Loading…
Reference in New Issue
Block a user