[Xfce4-commits] <midori:master> Shell quote argv[0] before spawning a process

Christian Dywan noreply at xfce.org
Sun Oct 3 07:18:06 CEST 2010


Updating branch refs/heads/master
         to b6247e33149f36fe09e07a2f9d95bdd5e7d4651a (commit)
       from 9a0e2bffef4ab39ec12c02cc8d4f03f9b26b09ad (commit)

commit b6247e33149f36fe09e07a2f9d95bdd5e7d4651a
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sun Oct 3 07:14:00 2010 +0200

    Shell quote argv[0] before spawning a process
    
    The path to the executable may contain spaces.

 midori/midori-browser.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/midori/midori-browser.c b/midori/midori-browser.c
index a719213..8f81ff9 100644
--- a/midori/midori-browser.c
+++ b/midori/midori-browser.c
@@ -2139,7 +2139,12 @@ static void
 midori_browser_spawn_app (const gchar* uri)
 {
     const gchar* executable = sokoke_get_argv (NULL)[0];
-    gchar* command = g_strconcat (executable, " -a", NULL);
+    /* "midori"
+       "/usr/bin/midori"
+       "c:/Program Files/Midori/bin/midori.exe" */
+    gchar* quoted = g_shell_quote (executable);
+    gchar* command = g_strconcat (quoted, " -a", NULL);
+    g_free (quoted);
     sokoke_spawn_program (command, uri, FALSE);
     g_free (command);
 }



More information about the Xfce4-commits mailing list