From: Orgad Shaneh Date: Sun, 30 Dec 2012 11:52:53 +0000 (+0200) Subject: gitweb: fix error in sanitize when highlight is enabled X-Git-Url: https://git.ladys.computer/Gitweb/commitdiff_plain/5ce6fab6c3d20a7655b5f79665609900cf9ffa2d817900e724a302acc7c8cc8c?ds=sidebyside 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 --- diff --git a/gitweb.perl b/gitweb.perl index 7543059..a42c311 100755 --- a/gitweb.perl +++ b/gitweb.perl @@ -1557,7 +1557,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; }