Fix #6516 - Check null deref before crashing in r_io

This commit is contained in:
pancake 2017-01-16 12:15:59 +01:00
parent 4687135c5b
commit b0fb7c9261
2 changed files with 4 additions and 2 deletions

View File

@ -485,7 +485,9 @@ R_API int r_core_read_at(RCore *core, ut64 addr, ut8 *buf, int size) {
}
return false;
}
r_io_use_desc (core->io, core->file->desc);
if (core->file) {
r_io_use_desc (core->io, core->file->desc);
}
return r_io_read_at (core->io, addr, buf, size);
}

View File

@ -281,7 +281,7 @@ R_API int r_io_reopen(RIO *io, RIODesc *desc, int flags, int mode) {
}
R_API int r_io_use_desc(RIO *io, RIODesc *d) {
if (d) {
if (d && d->plugin) {
io->desc = d;
io->plugin = d->plugin;
return true;