[PATCH] testbot: Only quote strings when needed in ShQuote().
Francois Gouget
fgouget at codeweavers.com
Mon Nov 19 09:37:20 CST 2018
Based on a short whitelist of safe characters.
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
testbot/lib/WineTestBot/Utils.pm | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/testbot/lib/WineTestBot/Utils.pm b/testbot/lib/WineTestBot/Utils.pm
index 6681072caa..a80f809d4c 100644
--- a/testbot/lib/WineTestBot/Utils.pm
+++ b/testbot/lib/WineTestBot/Utils.pm
@@ -248,6 +248,8 @@ in another context.
sub ShQuote($)
{
my ($Str)=@_;
+ return $Str if ($Str =~ /^[a-zA-Z0-9\/=:.,+_-]+$/);
+
$Str =~ s%\\%\\\\%g;
$Str =~ s%\$%\\\$%g;
$Str =~ s%\"%\\\"%g;
@@ -269,7 +271,7 @@ See also ShQuote().
sub ShArgv2Cmd(@)
{
- return join(' ', map { /[^a-zA-Z0-9\/.,+_-]/ ? ShQuote($_) : $_ } @_);
+ return join(' ', map { ShQuote($_) } @_);
}
1;
--
2.19.1
More information about the wine-devel
mailing list