Merge pull request #99154 from TredwellGit/generate-expr-from-tarballs.pl

generate-expr-from-tarballs.pl: fix insecure temporary file
This commit is contained in:
Andreas Rammhold 2020-10-02 16:48:00 +02:00 committed by GitHub
commit 6c282a2c61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 4 deletions

View File

@ -11,8 +11,7 @@ use warnings;
use File::Basename;
use File::Spec::Functions;
my $tmpDir = "/tmp/xorg-unpack";
use File::Temp;
my %pkgURLs;
@ -93,8 +92,7 @@ while (<>) {
$pkgHashes{$pkg} = $hash;
print "\nunpacking $path\n";
system "rm -rf '$tmpDir'";
mkdir $tmpDir, 0700;
my $tmpDir = File::Temp->newdir();
system "cd '$tmpDir' && tar xf '$path'";
die "cannot unpack `$path'" if $? != 0;
print "\n";