]> Lady’s Gitweb - Gitweb/commitdiff
gitweb: fix error in sanitize when highlight is enabled
authorOrgad Shaneh <redacted>
Sun, 30 Dec 2012 11:52:53 +0000 (13:52 +0200)
committerLady <redacted>
Mon, 6 Apr 2026 04:51:32 +0000 (00:51 -0400)
$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 <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl

index 75430594451adb1cbf3135893bfe6012708a37e0b68d03c545b1f4ae768591b1..a42c31175f36a6fa9496bde057dcdeb1dd342960a6d2792b64d960016465936b 100755 (executable)
@@ -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;
 }
 
This page took 0.267493 seconds and 4 git commands to generate.