Module: tools Branch: master Commit: ce79f49524f4d18c6107c7a6fa8a72b7b635beab URL: https://source.winehq.org/git/tools.git/?a=commit;h=ce79f49524f4d18c6107c7a6...
Author: Francois Gouget fgouget@codeweavers.com Date: Mon Nov 19 16:37:20 2018 +0100
testbot: Only quote strings when needed in ShQuote().
Based on a short whitelist of safe characters.
Signed-off-by: Francois Gouget fgouget@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
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 6681072..a80f809 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;