summaryrefslogtreecommitdiff
path: root/gitweb
diff options
context:
space:
mode:
authorOrgad Shaneh <orgads@gmail.com>2012-12-30 13:52:53 +0200
committerJunio C Hamano <gitster@pobox.com>2013-01-01 16:27:27 -0800
commit0e901d24fd70630ffed5411e6217c2dfce9c8da6 (patch)
treeb67631a2c0b023a1bc45f2a304cac83c0347d198 /gitweb
parentd0f1ea6003d97e63110fa7d50bb07f546a909b6e (diff)
downloadgit-0e901d24fd70630ffed5411e6217c2dfce9c8da6.tar.gz
gitweb: fix error in sanitize when highlight is enabled
$1 becomes undef by internal regex, since it has no capture groups. Match against accpetable control characters using index() instead of a regex. Signed-off-by: Orgad Shaneh <orgads@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'gitweb')
-rwxr-xr-xgitweb/gitweb.perl2
1 files changed, 1 insertions, 1 deletions
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index b67972ec5d..8d34d55884 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1538,7 +1538,7 @@ sub sanitize {
return undef unless defined $str;
$str = to_utf8($str);
- $str =~ s|([[:cntrl:]])|($1 =~ /[\t\n\r]/ ? $1 : quot_cec($1))|eg;
+ $str =~ s|([[:cntrl:]])|(index("\t\n\r", $1) != -1 ? $1 : quot_cec($1))|eg;
return $str;
}