From: cjwatson <> Date: Thu, 31 Oct 2002 09:53:21 +0000 (-0800) Subject: [project @ 2002-10-31 01:53:21 by cjwatson] X-Git-Tag: release/2.6.0~1012 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=7eceaf302a02b443fe656b026c93a6a83da0075a;p=debbugs.git [project @ 2002-10-31 01:53:21 by cjwatson] Stop using $`, $&, and $' in urlsanit() and htmlsanit(). --- diff --git a/cgi/common.pl b/cgi/common.pl index d4139ce6..1d42b720 100644 --- a/cgi/common.pl +++ b/cgi/common.pl @@ -217,25 +217,15 @@ sub urlsanit { $url =~ s/%/%25/g; $url =~ s/\+/%2b/g; my %saniarray = ('<','lt', '>','gt', '&','amp', '"','quot'); - my $out; - while ($url =~ m/[<>&"]/) { - $out .= $`. '&'. $saniarray{$&}. ';'; - $url = $'; - } - $out .= $url; - return $out; + $url =~ s/([<>&"])/\&$saniarray{$1};/g; + return $url; } sub htmlsanit { my %saniarray = ('<','lt', '>','gt', '&','amp', '"','quot'); my $in = shift || ""; - my $out; - while ($in =~ m/[<>&"]/) { - $out .= $`. '&'. $saniarray{$&}. ';'; - $in = $'; - } - $out .= $in; - return $out; + $in =~ s/([<>&"])/\&$saniarray{$1};/g; + return $in; } sub bugurl {