mirror of
https://github.com/radareorg/radare2.git
synced 2025-02-11 09:05:33 +00:00
Make r2k and gdb rwx by default
This commit is contained in:
parent
b597dcfa45
commit
6d1be4ad06
@ -1000,6 +1000,7 @@ int main(int argc, char **argv, char **envp) {
|
||||
if (fh) {
|
||||
iod = r.io ? r_io_desc_get (r.io, fh->fd) : NULL;
|
||||
if (iod) {
|
||||
perms = iod->flags;
|
||||
r_io_map_new (r.io, iod->fd, perms, 0LL, 0LL, r_io_desc_size (iod), true);
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@
|
||||
#define R_IO_WRITE 2
|
||||
#define R_IO_EXEC 1
|
||||
#define R_IO_RW (R_IO_READ|R_IO_WRITE)
|
||||
#define R_IO_RWX (R_IO_READ|R_IO_WRITE|R_IO_EXEC)
|
||||
#define R_IO_PRIV 16
|
||||
#define R_IO_SHAR 32 //wtf is this
|
||||
|
||||
|
@ -30,6 +30,9 @@ static int debug_gdb_read_at(ut8 *buf, int sz, ut64 addr) {
|
||||
return -1;
|
||||
}
|
||||
size_max = desc->data_max / 2;
|
||||
if (size_max < 1) {
|
||||
size_max = sz;
|
||||
}
|
||||
packets = sz / size_max;
|
||||
last = sz % size_max;
|
||||
for (x = 0; x < packets; x++) {
|
||||
@ -83,12 +86,13 @@ static RIODesc *__open(RIO *io, const char *file, int rw, int mode) {
|
||||
// FIX: Don't allocate more than one gdb RIODesc
|
||||
return riogdb;
|
||||
}
|
||||
strncpy (host, file + 6, sizeof (host)-1);
|
||||
strncpy (host, file + 6, sizeof (host) - 1);
|
||||
host [sizeof (host) - 1] = '\0';
|
||||
if (host[0] == '/') {
|
||||
isdev = true;
|
||||
}
|
||||
|
||||
rw |= R_IO_WRITE;
|
||||
if (isdev) {
|
||||
port = strchr (host, '@');
|
||||
if (port) {
|
||||
@ -143,7 +147,7 @@ static RIODesc *__open(RIO *io, const char *file, int rw, int mode) {
|
||||
} else if ((i_pid = desc->pid) < 0) {
|
||||
i_pid = -1;
|
||||
}
|
||||
riogdb = r_io_desc_new (io, &r_io_plugin_gdb, file, rw, mode, riog);
|
||||
riogdb = r_io_desc_new (io, &r_io_plugin_gdb, file, R_IO_RWX, mode, riog);
|
||||
}
|
||||
// Get name
|
||||
if (riogdb) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* radare - LGPL - Copyright 2008-2016 - pancake */
|
||||
/* radare - LGPL - Copyright 2008-2017 - pancake */
|
||||
|
||||
#include "r_io.h"
|
||||
#include "r_lib.h"
|
||||
@ -165,7 +165,7 @@ static RIODesc *__open(RIO *io, const char *pathname, int rw, int mode) {
|
||||
}
|
||||
int len;
|
||||
ut8 *data = (ut8*)r_file_slurp (pathname+7, &len); //memleak here?
|
||||
int *size = mal->size;
|
||||
int *size = (int*)&mal->size;
|
||||
mal->buf = r_inflate (data, len, NULL, size);
|
||||
if (mal->buf) {
|
||||
return r_io_desc_new (io, &r_io_plugin_gzip, pathname, rw, mode, mal);
|
||||
|
@ -101,6 +101,8 @@ static int r2k__system(RIO *io, RIODesc *fd, const char *cmd) {
|
||||
|
||||
static RIODesc *r2k__open(RIO *io, const char *pathname, int rw, int mode) {
|
||||
if (!strncmp (pathname, "r2k://", 6)) {
|
||||
rw |= R_IO_WRITE;
|
||||
rw |= R_IO_EXEC;
|
||||
#if __WINDOWS__
|
||||
RIOW32 *w32 = R_NEW0 (RIOW32);
|
||||
if (Init (&pathname[6]) == FALSE) {
|
||||
|
@ -81,9 +81,9 @@ int gdbr_cleanup(libgdbr_t *g) {
|
||||
if (!g) {
|
||||
return -1;
|
||||
}
|
||||
free (g->data);
|
||||
free (g->send_buff);
|
||||
R_FREE (g->data);
|
||||
g->send_len = 0;
|
||||
free (g->read_buff);
|
||||
R_FREE (g->send_buff);
|
||||
R_FREE (g->read_buff);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user