[game-data-packager] 06/11: doom2-masterlevels: don't use os.system

Simon McVittie smcv at debian.org
Tue Mar 31 09:46:28 UTC 2015


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch master
in repository game-data-packager.

commit e12ee8c9490900a359182b0c6ade5109c11388d1
Author: Simon McVittie <smcv at debian.org>
Date:   Tue Mar 31 10:06:37 2015 +0100

    doom2-masterlevels: don't use os.system
    
    It is unsuitable for GUI applications for at least two reasons:
    it is vulnerable to shell injection (not actually relevant here
    since the arguments are hard-coded), and it blocks the calling
    process until the called process exits.
---
 runtime/doom2-masterlevels.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/runtime/doom2-masterlevels.py b/runtime/doom2-masterlevels.py
index 3c301d5..f585fe6 100755
--- a/runtime/doom2-masterlevels.py
+++ b/runtime/doom2-masterlevels.py
@@ -196,8 +196,9 @@ def run_game(event):
             break
     if 'doomsday' in engine:
         engine = 'doomsday -game doom2'
-    if warp:
-        os.system('%s -file /usr/share/games/doom/%s.wad -warp %s -skill %s' % (engine, game, warp, difficulty))
+
+    subprocess.call([engine, '-file', '/usr/share/games/doom/%s.wad' % game,
+        '-warp', '%d' % warp, '-skill', difficulty])
 
 treeview.connect("cursor-changed", select_game)
 button1.connect("clicked", run_game)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/game-data-packager.git



More information about the Pkg-games-commits mailing list