Francois Gouget : testbot/cgi: Better escape error messages.
Alexandre Julliard
julliard at winehq.org
Wed Mar 2 14:36:02 CST 2022
Module: tools
Branch: master
Commit: db5b61b57833f73ac984954921390968ea49ded5
URL: https://source.winehq.org/git/tools.git/?a=commit;h=db5b61b57833f73ac984954921390968ea49ded5
Author: Francois Gouget <fgouget at codeweavers.com>
Date: Wed Mar 2 17:02:30 2022 +0100
testbot/cgi: Better escape error messages.
This allows using newlines and quotes in error messages.
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
testbot/lib/WineTestBot/CGI/PageBase.pm | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/testbot/lib/WineTestBot/CGI/PageBase.pm b/testbot/lib/WineTestBot/CGI/PageBase.pm
index fa40699..8b046c8 100644
--- a/testbot/lib/WineTestBot/CGI/PageBase.pm
+++ b/testbot/lib/WineTestBot/CGI/PageBase.pm
@@ -358,8 +358,10 @@ sub GenerateErrorPopup($$)
{
print "<script type='text/javascript'>\n";
print "<!--\n";
- $ErrMessage =~ s/'/\\'/g;
- print "function ShowError() { alert('", $ErrMessage, "'); }\n";
+ $ErrMessage =~ s~\\~\\\\~g;
+ $ErrMessage =~ s~"~\\\"~g;
+ $ErrMessage =~ s~\n~\\n~g;
+ print "function ShowError() { alert(\"$ErrMessage\"); }\n";
my $ErrField = $Page->GetErrField();
if ($ErrField)
{
More information about the wine-cvs
mailing list