Skip to content

Commit 0e901d2

Browse files
orgadsgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d0f1ea6 commit 0e901d2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

gitweb/gitweb.perl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1538,7 +1538,7 @@ sub sanitize {
15381538
return undef unless defined $str;
15391539

15401540
$str = to_utf8($str);
1541-
$str =~ s|([[:cntrl:]])|($1 =~ /[\t\n\r]/ ? $1 : quot_cec($1))|eg;
1541+
$str =~ s|([[:cntrl:]])|(index("\t\n\r", $1) != -1 ? $1 : quot_cec($1))|eg;
15421542
return $str;
15431543
}
15441544

0 commit comments

Comments
 (0)