Escape arguments when putting together a cmdline
authorMatthias Clasen <mclasen@redhat.com>
Thu, 8 Jul 2010 18:58:33 +0000 (14:58 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 8 Jul 2010 18:58:33 +0000 (14:58 -0400)
See bug 623770

gio/gdesktopappinfo.c

index 6600684..ea2d403 100644 (file)
@@ -698,18 +698,28 @@ expand_macro (char              macro,
       if (info->icon_name)
        {
          g_string_append (exec, "--icon ");
-         g_string_append (exec, info->icon_name);
+          expanded = g_shell_quote (info->icon_name);
+         g_string_append (exec, expanded);
+          g_free (expanded);
        }
       break;
 
     case 'c':
       if (info->name) 
-       g_string_append (exec, info->name);
+        {
+          expanded = g_shell_quote (info->name);
+         g_string_append (exec, expanded);
+          g_free (expanded);
+        }
       break;
 
     case 'k':
       if (info->filename) 
-       g_string_append (exec, info->filename);
+        {
+          expanded = g_shell_quote (info->filename);
+         g_string_append (exec, info->filename);
+          g_free (expanded);
+        }
       break;
 
     case 'm': /* deprecated */