diff --git a/libr/core/cmd_debug.c b/libr/core/cmd_debug.c index da9d16b766..fd651faa03 100644 --- a/libr/core/cmd_debug.c +++ b/libr/core/cmd_debug.c @@ -1115,11 +1115,18 @@ static int cmd_debug_map(RCore *core, const char *input) { char *res; const char *file = map->file? map->file: map->name; char *name = r_str_escape ((char *)r_file_basename (file)); + char *filesc = r_str_escape (file); + /* TODO: do not spawn. use RBin API */ if (sectname) { - res = r_sys_cmd_strf ("env RABIN2_PREFIX=\"%s\" rabin2 %s-B 0x%08"PFMT64x" -S %s | grep %s", name, mode, baddr, file, sectname); + char *sect = r_str_escape (sectname); + res = r_sys_cmd_strf ("env RABIN2_PREFIX=\"%s\" rabin2 %s-B 0x%08" + PFMT64x" -S \"%s\" | grep \"%s\"", name, mode, baddr, filesc, sect); + free (sect); } else { - res = r_sys_cmd_strf ("env RABIN2_PREFIX=\"%s\" rabin2 %s-B 0x%08"PFMT64x" -S %s", name, mode, baddr, file); + res = r_sys_cmd_strf ("env RABIN2_PREFIX=\"%s\" rabin2 %s-B 0x%08" + PFMT64x" -S \"%s\"", name, mode, baddr, filesc); } + free (filesc); r_cons_println (res); free(name); free (res);