summaryrefslogtreecommitdiff
path: root/scripts/checkkconfigsymbols.py
diff options
context:
space:
mode:
authorValentin Rothberg <valentinrothberg@gmail.com>2016-08-27 10:59:07 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-08-27 11:44:01 +0200
commitf175ba174ef3cb8c26e828c710e4e3b0f2bbbf55 (patch)
treea328628294db949c1099a57f9317e4184fd44122 /scripts/checkkconfigsymbols.py
parent4c73c0882b34d0383ff417e2d66c127f848cfe06 (diff)
downloadlwn-f175ba174ef3cb8c26e828c710e4e3b0f2bbbf55.tar.gz
lwn-f175ba174ef3cb8c26e828c710e4e3b0f2bbbf55.zip
checkkconfigsymbols.py: avoid shell injection
Use subprocess and set shell to False to avoid potential shell injections. Reported-by: Bernd Dietzel <tcpip@t-online.de> Signed-off-by: Valentin Rothberg <valentinrothberg@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'scripts/checkkconfigsymbols.py')
-rwxr-xr-xscripts/checkkconfigsymbols.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/scripts/checkkconfigsymbols.py b/scripts/checkkconfigsymbols.py
index b140fc9018b1..0cae73b5c925 100755
--- a/scripts/checkkconfigsymbols.py
+++ b/scripts/checkkconfigsymbols.py
@@ -2,7 +2,7 @@
"""Find Kconfig symbols that are referenced but not defined."""
-# (c) 2014-2015 Valentin Rothberg <valentinrothberg@gmail.com>
+# (c) 2014-2016 Valentin Rothberg <valentinrothberg@gmail.com>
# (c) 2014 Stefan Hengelein <stefan.hengelein@fau.de>
#
# Licensed under the terms of the GNU GPL License version 2
@@ -12,6 +12,7 @@ import difflib
import os
import re
import signal
+import subprocess
import sys
from multiprocessing import Pool, cpu_count
from optparse import OptionParser
@@ -222,10 +223,11 @@ def red(string):
def execute(cmd):
"""Execute %cmd and return stdout. Exit in case of error."""
- pop = Popen(cmd, stdout=PIPE, stderr=STDOUT, shell=True)
- (stdout, _) = pop.communicate() # wait until finished
- if pop.returncode != 0:
- sys.exit(stdout)
+ try:
+ cmdlist = cmd.split(" ")
+ stdout = subprocess.check_output(cmdlist, stderr=STDOUT, shell=False)
+ except subprocess.CalledProcessError as fail:
+ exit("Failed to execute %s\n%s" % (cmd, fail))
return stdout