Fix segfault in 'r2 -c 'dso;dso' -'

This commit is contained in:
pancake 2014-07-18 18:48:11 +02:00
parent b1068c8c6a
commit 7507868d47
1 changed files with 2 additions and 2 deletions

View File

@ -45,7 +45,7 @@ R_API int r_reg_set_bytes(RReg *reg, int type, const ut8* buf, int len) {
struct r_reg_set_t *regset;
RRegArena *arena;
int off = 0;
if (len<0)
if (len<0 || !buf)
return R_FALSE;
if (type == -1) {
@ -115,7 +115,7 @@ R_API int r_reg_fit_arena(RReg *reg) {
arena = reg->regset[i].arena;
newsize = 0;
r_list_foreach (reg->regset[i].regs, iter, r) {
int regsize_in_bytes = r->size / 8;
//int regsize_in_bytes = r->size / 8;
// XXX: bits2bytes doesnt seems to work fine
size = BITS2BYTES (r->offset+r->size);
newsize = R_MAX (size, newsize);