Skip to content

Commit

Permalink
More aggressive shell string escaping.
Browse files Browse the repository at this point in the history
Partially fixes Bugzilla #4074.
  • Loading branch information
icculus committed Jul 7, 2009
1 parent bd89c12 commit 3eea083
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scripts/mojosetup_mainline.lua
Expand Up @@ -1002,7 +1002,7 @@ local function install_unix_uninstaller(desc, key)
"uninstall-" .. MojoSetup.install.id .. ".sh"

-- Man, I hate escaping shell strings...
local bin = "\"`dirname $0`\"'/" .. MojoSetup.metadatadirname .. "/" ..
local bin = "\"`dirname \"$0\"`\"'/" .. MojoSetup.metadatadirname .. "/" ..
MojoSetup.controlappname .. "'"
string.gsub(bin, "'", "'\\''") -- !!! FIXME: no-op!-- Escape single quotes for shell.

Expand Down Expand Up @@ -1114,6 +1114,9 @@ local function install_freedesktop_menuitem(pkg, idx, item) -- only for Unix.

local cmdline = MojoSetup.format(item.commandline, dest)

-- Try to escape some characters...
cmdline = '"' .. string.gsub(string.gsub(cmdline, "\"","\\\""), "%%", "%%%%") .. '"'

local t = { "[Desktop Entry]\n" }
local function addpair(key, val)
t[#t+1] = key
Expand Down

0 comments on commit 3eea083

Please sign in to comment.