From 22244403a126892b0f61ec670f7d1ab60dfbb97c Mon Sep 17 00:00:00 2001 From: Liumeo Date: Sun, 10 Jan 2021 20:52:24 -0500 Subject: [PATCH] Fix `doo` segfault (#18201) --- libr/core/cmd_open.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libr/core/cmd_open.c b/libr/core/cmd_open.c index 2a491adc3b..580bc89ea6 100644 --- a/libr/core/cmd_open.c +++ b/libr/core/cmd_open.c @@ -1142,9 +1142,9 @@ R_API void r_core_file_reopen_debug(RCore *core, const char *args) { if (!(desc->plugin && desc->plugin->isdbg) && (desc->perm & R_PERM_W)) { eprintf ("Cannot debug file (%s) with permissions set to 0x%x.\n" "Reopening the original file in read-only mode.\n", desc->name, desc->perm); - r_io_reopen (core->io, desc->fd, R_PERM_RX, 755); - // r_io_reopen (core->io, ofile->fd, R_PERM_R, 644); - desc = r_io_desc_get (core->io, desc->fd); + int fd = desc->fd; + r_io_reopen (core->io, fd, R_PERM_RX, 755); + desc = r_io_desc_get (core->io, fd); } RBinFile *bf = r_bin_file_find_by_fd (core->bin, desc->fd);