[PATCH] testbot/LogUtils: GetLogFileNames() should untaint the returned log names.
Francois Gouget
fgouget at codeweavers.com
Thu Dec 5 06:23:19 CST 2019
Otherwise the caller may get an error when trying to use them for file
operations (such as unlink).
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
testbot/lib/WineTestBot/LogUtils.pm | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/testbot/lib/WineTestBot/LogUtils.pm b/testbot/lib/WineTestBot/LogUtils.pm
index 32bf0fa61..4a17857f8 100644
--- a/testbot/lib/WineTestBot/LogUtils.pm
+++ b/testbot/lib/WineTestBot/LogUtils.pm
@@ -634,13 +634,21 @@ sub GetLogFileNames($;$)
foreach my $FileName (glob("'$Dir/$Glob*'"))
{
my $LogName = basename($FileName);
- if ($LogName !~ s/\.err$// and $LogName !~ /\.report$/ and
- $LogName ne $Glob) # 'log' case
+ $LogName =~ s/\.err$//;
+ next if ($Seen{$LogName});
+ if ($LogName =~ /^([a-zA-Z0-9_]+\.report)$/)
+ {
+ $LogName = $1; # untaint
+ }
+ elsif ($LogName eq $Glob) # log and old_log cases
+ {
+ $LogName = $Glob; # untaint
+ }
+ else
{
# Not a valid log filename (where does this file come from?)
next;
}
- next if ($Seen{$LogName});
$Seen{$LogName} = 1;
if ((-f "$Dir/$LogName" and !-z "$Dir/$LogName") or
--
2.20.1
More information about the wine-devel
mailing list