1 Description: Escape theme name before passing it to system(3)
2 Bug-Debian: https://bugs.debian.org/739709
3 Author: Marius Gavrilescu <marius@ieval.ro>
5 Last-Update: 2014-02-23
13 +static gchar *shell_escape (gchar *arg)
18 + out = g_new(gchar, strlen(arg) * 2 + 1);
35 static short install_tarball (gchar *path, gchar **rc_file)
37 - gchar *command, *themedir;
38 + gchar *command, *themedir, *escaped_path;
40 GList *new_list, *new_theme;
42 themedir = g_strdup_printf ("%s/.themes", homedir);
43 + escaped_path = shell_escape (path);
47 gchar *cwd = g_get_current_dir();
48 - command = g_strdup_printf ("tar --directory %s -xzf %s/%s 2>/dev/null", themedir, cwd, path);
49 + command = g_strdup_printf ("tar --directory %s -xzf %s/'%s' 2>/dev/null", themedir, cwd, escaped_path);
53 - command = g_strdup_printf ("tar --directory %s -xzf %s 2>/dev/null", themedir, path);
54 + command = g_strdup_printf ("tar --directory %s -xzf '%s' 2>/dev/null", themedir, escaped_path);
56 /* Ensure that ~/.themes exists */
57 mkdir (themedir, S_IRUSR | S_IWUSR | S_IXUSR);
59 result = system(command);
60 + g_free (escaped_path);
63 if (result != EXIT_SUCCESS)