]> spindle.queued.net Git - midori/commitdiff
Shell quote argv[0] before spawning a process
authorChristian Dywan <christian@twotoasts.de>
Sun, 3 Oct 2010 05:14:00 +0000 (07:14 +0200)
committerChristian Dywan <christian@twotoasts.de>
Sun, 3 Oct 2010 05:15:44 +0000 (07:15 +0200)
The path to the executable may contain spaces.

midori/midori-browser.c

index a71921372e789903a1a5b6b29a496c4257df1fb3..8f81ff9a6949b394c9fd317b578e5e5765bb07c4 100644 (file)
@@ -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);
 }