From bc9098242e54d481b2c5e2cef970568ab5e953cb Mon Sep 17 00:00:00 2001 From: John Darrington Date: Thu, 5 Jan 2012 21:01:20 +0100 Subject: [PATCH] online_help: use g_spawn_async instead of g_spawn_command_line_async This change avoids potential problems caused by metacharacters in the constructed command arguments. Suggested by Ben Pfaff. --- src/ui/gui/help-menu.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/ui/gui/help-menu.c b/src/ui/gui/help-menu.c index f746441c..9d1ccf82 100644 --- a/src/ui/gui/help-menu.c +++ b/src/ui/gui/help-menu.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2006, 2007, 2010 Free Software Foundation + Copyright (C) 2006, 2007, 2010, 2011, 2012 Free Software Foundation This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -92,12 +92,16 @@ online_help (const char *page) GError *err = NULL; gchar *cmd = NULL; + gchar *argv[3] = { "yelp", 0, 0}; + if (page == NULL) - cmd = g_strdup_printf ("yelp file://%s", relocate (DOCDIR "/pspp.xml")); + argv[1] = g_strdup_printf ("file://%s", relocate (DOCDIR "/pspp.xml")); else - cmd = g_strdup_printf ("yelp file://%s\\#%s", relocate (DOCDIR "/pspp.xml"), page); + argv[1] = g_strdup_printf ("file://%s#%s", relocate (DOCDIR "/pspp.xml"), page); - if ( ! g_spawn_command_line_async (cmd, &err) ) + if (! g_spawn_async (NULL, argv, + NULL, G_SPAWN_SEARCH_PATH, + NULL, NULL, NULL, &err)) { msg (ME, _("Cannot open reference manual: %s. The PSPP user manual is " "also available at %s"), -- 2.30.2