aboutsummaryrefslogtreecommitdiffstats
path: root/testserver.pl
diff options
context:
space:
mode:
authorGervase Markham <gerv@mozilla.org>2015-01-21 20:06:08 +0000
committerDavid Lawrence <dkl@mozilla.com>2015-01-21 20:06:08 +0000
commit19117cc3e4da268d64107957e4c206d8df875505 (patch)
tree81546dbda0b66c7463407c3854ee98689326dc15 /testserver.pl
parent272b0b69b2884d937ffd4b5b01fb89235603c67c (diff)
downloadbugs-19117cc3e4da268d64107957e4c206d8df875505.tar
bugs-19117cc3e4da268d64107957e4c206d8df875505.tar.gz
bugs-19117cc3e4da268d64107957e4c206d8df875505.tar.bz2
bugs-19117cc3e4da268d64107957e4c206d8df875505.tar.xz
bugs-19117cc3e4da268d64107957e4c206d8df875505.zip
Bug 1079065: [SECURITY] Always use the 3 arguments form for open() to prevent shell code injection
r=dkl,a=glob
Diffstat (limited to 'testserver.pl')
-rwxr-xr-xtestserver.pl6
1 files changed, 3 insertions, 3 deletions
diff --git a/testserver.pl b/testserver.pl
index 2ab48f375..d827c80ea 100755
--- a/testserver.pl
+++ b/testserver.pl
@@ -40,7 +40,7 @@ my @pscmds = ('ps -eo comm,gid', 'ps -acxo command,gid', 'ps -acxo command,rgid'
my $sgid = 0;
if (!ON_WINDOWS) {
foreach my $pscmd (@pscmds) {
- open PH, "$pscmd 2>/dev/null |";
+ open PH, '-|', "$pscmd 2>/dev/null";
while (my $line = <PH>) {
if ($line =~ /^(?:\S*\/)?(?:httpd|apache?)2?\s+(\d+)$/) {
$sgid = $1 if $1 > $sgid;
@@ -267,7 +267,7 @@ sub check_image {
sub create_file {
my ($filename, $content) = @_;
- open(FH, ">$filename")
+ open(FH, ">", $filename)
or die "Failed to create $filename: $!\n";
binmode FH;
print FH $content;
@@ -276,7 +276,7 @@ sub create_file {
sub read_file {
my ($filename) = @_;
- open(FH, $filename)
+ open(FH, '<', $filename)
or die "Failed to open $filename: $!\n";
binmode FH;
my $content = <FH>;