Fix some null derefs in r2 gdb:// (without -d), still buggy

This commit is contained in:
pancake 2017-09-12 01:51:18 +02:00
parent 6d1be4ad06
commit eb64f16fa3
3 changed files with 5 additions and 2 deletions

View File

@ -1061,7 +1061,7 @@ R_API int r_bin_load_io_at_offset_as_sz(RBin *bin, int fd, ut64 baseaddr,
}
}
if (!name) {
if (!name && (st64)sz > 0) {
// XXX - for the time being this is fine, but we may want to
// change the name to something like
// <xtr_name>:<bin_type_name>

View File

@ -369,7 +369,7 @@ static const char *r_debug_gdb_reg_profile(RDebug *dbg) {
int arch = r_sys_arch_id (dbg->arch);
int bits = dbg->anal->bits;
check_connection (dbg);
if (desc && desc->target.valid) {
if (desc && desc->target.valid && desc->target.regprofile) {
return strdup (desc->target.regprofile);
}
switch (arch) {

View File

@ -180,6 +180,9 @@ static ut64 __lseek(RIO *io, RIODesc *fd, ut64 offset, int whence) {
}
static int __read(RIO *io, RIODesc *fd, ut8 *buf, int count) {
if (!io || !fd || !buf || count < 1) {
return -1;
}
memset (buf, 0xff, count);
ut64 addr = io->off;
if (!desc || !desc->data) {