diff --git a/libr/bin/bin.c b/libr/bin/bin.c index 9d4d8f459e..53394262ec 100644 --- a/libr/bin/bin.c +++ b/libr/bin/bin.c @@ -146,6 +146,7 @@ R_API int r_bin_load_languages(RBin *bin) { return R_BIN_NM_CXX; return R_BIN_NM_NONE; } + static void set_bin_items(RBin *bin, RBinPlugin *cp) { RBinArch *a = &bin->cur; @@ -171,9 +172,6 @@ static void set_bin_items(RBin *bin, RBinPlugin *cp) { if (cp->classes) o->classes = cp->classes (a); if (cp->lines) o->lines = cp->lines (a); o->lang = r_bin_load_languages (bin); - - - } R_API int r_bin_io_load(RBin *bin, RIO *io, RIODesc *desc, int dummy) { @@ -326,7 +324,6 @@ static void r_bin_free_items(RBin *bin) { a->curplugin->destroy (a); } - static void r_bin_init(RBin *bin, int rawstr) { RListIter *it; RBinXtrPlugin *xtr; @@ -695,10 +692,9 @@ R_API int r_bin_class_add_method (RBin *bin, const char *classname, const char * if (c) { r_list_append (c->methods, (void*)name); return R_TRUE; - } else { - c = r_bin_class_new (bin, classname, NULL, 0); - r_list_append (c->methods, (void*)name); } + c = r_bin_class_new (bin, classname, NULL, 0); + r_list_append (c->methods, (void*)name); return R_FALSE; } @@ -713,7 +709,7 @@ R_API ut64 r_bin_get_offset (RBin *bin) { R_API ut64 r_bin_get_vaddr (RBin *bin, ut64 baddr, ut64 paddr, ut64 vaddr) { RBinPlugin *cp = bin->cur.curplugin; - if(cp && cp->get_vaddr) + if (cp && cp->get_vaddr) return cp->get_vaddr (baddr, paddr, vaddr); ut32 delta; diff --git a/libr/bin/p/bin_fs.c b/libr/bin/p/bin_fs.c index 923dff6237..0d825717b4 100644 --- a/libr/bin/p/bin_fs.c +++ b/libr/bin/p/bin_fs.c @@ -1,4 +1,4 @@ -/* radare - LGPL - Copyright 2011-2012 - pancake */ +/* radare - LGPL - Copyright 2011-2013 - pancake */ #include #include @@ -15,9 +15,11 @@ static char *fsname(RBinArch *arch) { for (i=0; fstypes[i].name; i++) { RFSType *f = &fstypes[i]; len = R_MIN (f->buflen, sizeof (buf)); + memset (buf, 0, sizeof (buf)); r_buf_read_at (arch->buf, f->bufoff, buf, len); if ((f->buflen>0) && (len>=f->buflen)) { - if (!memcmp (buf, f->buf, f->buflen)) { + int min = R_MIN (f->buflen, sizeof (buf)); + if (!memcmp (buf, f->buf, min)) { ret = R_TRUE; len = R_MIN (f->bytelen, sizeof (buf)); r_buf_read_at (arch->buf, f->byteoff, buf, len); diff --git a/libr/core/cmd_help.c b/libr/core/cmd_help.c index f14791ee87..fa4e7b5f06 100644 --- a/libr/core/cmd_help.c +++ b/libr/core/cmd_help.c @@ -487,7 +487,7 @@ static int cmd_help(void *data, const char *input) { " y [len] [off] yank/paste bytes from/to memory\n" " ?[??] [expr] help or evaluate math expression\n" " ?$? show available '$' variables\n" - " ?@? show help for '@' and '~' suffix\n" + " ?@? show help for '@' (seek) and '~' (grep) suffix (see ~??)\n" ); break; } diff --git a/libr/util/sandbox.c b/libr/util/sandbox.c index ec3de0d69c..1c743724e1 100644 --- a/libr/util/sandbox.c +++ b/libr/util/sandbox.c @@ -66,7 +66,9 @@ R_API int r_sandbox_open (const char *path, int mode, int perm) { #if __WINDOWS__ perm = 0; #endif - return open (path, mode, perm); + if (path) + return open (path, mode, perm); + return -1; } R_API FILE *r_sandbox_fopen (const char *path, const char *mode) { @@ -76,7 +78,9 @@ R_API FILE *r_sandbox_fopen (const char *path, const char *mode) { if (!r_sandbox_check_path (path)) return NULL; } - return fopen (path, mode); + if (path) + return fopen (path, mode); + return NULL; } R_API int r_sandbox_chdir (const char *path) {