From 549954949a402ba5bc84cfb83cda3d62a8e1a887 Mon Sep 17 00:00:00 2001 From: "justdave%syndicomm.com" <> Date: Sat, 25 Aug 2001 00:32:24 +0000 Subject: Fix for bug 95235: variables with untrusted content were being echoed back to the user in error messages. Those variables are now run through html_quote() first. Patch by Gavin Shelley r= justdave@syndicomm.com --- buglist.cgi | 14 +++++++++----- process_bug.cgi | 3 ++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/buglist.cgi b/buglist.cgi index 0f6dbed41..2b2a394bf 100755 --- a/buglist.cgi +++ b/buglist.cgi @@ -85,7 +85,7 @@ sub SqlifyDate { } my $date = str2time($str); if (!defined $date) { - PuntTryAgain("The string '$str' is not a legal date."); + PuntTryAgain("The string '".html_quote($str)."' is not a legal date."); } return time2str("%Y/%m/%d %H:%M:%S", $date); } @@ -172,7 +172,8 @@ sub GenerateSQL { if ($c ne "") { if ($c !~ /^[0-9]*$/) { return Error("The 'At least ___ votes' field must be a\n" . - "simple number. You entered \"$c\", which\n" . + "simple number. You entered \"" . + html_quote($c) . "\", which\n" . "doesn't cut it."); } push(@specialchart, ["votes", "greaterthan", $c - 1]); @@ -250,7 +251,8 @@ sub GenerateSQL { push(@specialchart, \@clist); } else { return Error("You must specify one or more fields in which to\n" . - "search for $email.\n"); + "search for " . + html_quote($email) . ".\n"); } } @@ -260,7 +262,8 @@ sub GenerateSQL { if ($c ne "") { if ($c !~ /^[0-9]*$/) { return Error("The 'changed in last ___ days' field must be\n" . - "a simple number. You entered \"$c\", which\n" . + "a simple number. You entered \"" . + html_quote($c) . "\", which\n" . "doesn't cut it."); } push(@specialchart, ["changedin", @@ -428,7 +431,8 @@ sub GenerateSQL { if ($id) { push(@list, "$table.keywordid = $id"); } else { - return Error("Unknown keyword named $v.\n" . + return Error("Unknown keyword named " . + html_quote($v) . ".\n" . "

The legal keyword names are\n" . "" . "listed here.\n"); diff --git a/process_bug.cgi b/process_bug.cgi index 82e9cb988..53ec8d9da 100755 --- a/process_bug.cgi +++ b/process_bug.cgi @@ -749,7 +749,8 @@ if ($::FORM{'keywords'}) { } my $i = GetKeywordIdFromName($keyword); if (!$i) { - PuntTryAgain("Unknown keyword named $keyword. " . + PuntTryAgain("Unknown keyword named " . + html_quote($keyword) . ". " . "

The legal keyword names are " . "" . "listed here."); -- cgit v1.2.3-24-g4f1b