From 0e901d24fd70630ffed5411e6217c2dfce9c8da6 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Sun, 30 Dec 2012 13:52:53 +0200 Subject: [PATCH] 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 Signed-off-by: Junio C Hamano --- gitweb/gitweb.perl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } -- 2.11.4.GIT