[gnome-builder] io: escape paths before calling wordexp()
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] io: escape paths before calling wordexp()
- Date: Thu, 6 Jan 2022 00:44:17 +0000 (UTC)
commit 21333c189bf09fecbf08c198f2e15786d4138b4c
Author: Christian Hergert <chergert redhat com>
Date: Wed Jan 5 16:44:02 2022 -0800
io: escape paths before calling wordexp()
src/libide/io/ide-path.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/libide/io/ide-path.c b/src/libide/io/ide-path.c
index 17a8bd720..5f2e62fc5 100644
--- a/src/libide/io/ide-path.c
+++ b/src/libide/io/ide-path.c
@@ -46,13 +46,15 @@ gchar *
ide_path_expand (const gchar *path)
{
wordexp_t state = { 0 };
- gchar *ret = NULL;
+ char *ret = NULL;
+ char *escaped;
int r;
if (path == NULL)
return NULL;
- r = wordexp (path, &state, WRDE_NOCMD);
+ escaped = g_shell_quote (path);
+ r = wordexp (escaped, &state, WRDE_NOCMD);
if (r == 0 && state.we_wordc > 0)
ret = g_strdup (state.we_wordv [0]);
wordfree (&state);
@@ -64,6 +66,8 @@ ide_path_expand (const gchar *path)
ret = g_build_filename (g_get_home_dir (), freeme, NULL);
}
+ g_free (escaped);
+
return ret;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]