Fix UAF in cmd_open

This commit is contained in:
pancake 2022-02-28 10:08:58 +01:00
parent 118da0245f
commit b965ce3340
1 changed files with 2 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2009-2021 - pancake */
/* radare - LGPL - Copyright 2009-2022 - pancake */
#include <r_bin.h>
#include <r_debug.h>
@ -2183,10 +2183,9 @@ static int cmd_open(void *data, const char *input) {
if ((fdx == -1) || (fd == -1) || (fdx == fd)) {
free (inp);
break;
} else {
free (inp);
}
r_io_desc_exchange (core->io, fd, fdx);
free (inp);
r_core_block_read (core);
} else {
eprintf ("Usage: ox [fd] [fdx] - exchange two file descriptors\n");