{"thread":{"id":"32478","subject":"[PATCH] gitweb: fix error in sanitize when highlight is enabled","startedAt":"2012-12-30T11:52:53Z","lastAt":"2012-12-30T11:52:53Z","messageCount":1,"participants":["Orgad Shaneh"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"205671","messageId":"1356868373-12721-1-git-send-email-orgads@gmail.com","threadId":"32478","inReplyTo":null,"subject":"[PATCH] gitweb: fix error in sanitize when highlight is enabled","fromName":"Orgad Shaneh","fromEmail":"orgads@gmail.com","sentAt":"2012-12-30T11:52:53Z","receivedAt":"2012-12-30T11:52:53Z","isPatch":true,"sender":{"key":"orgads@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1246544?v=4"},"body":"$1 becomes undef by internal regex, since it has no capture groups.\n\nMatch against accpetable control characters using index() instead of a regex.\n\nSigned-off-by: Orgad Shaneh <orgads@gmail.com>\n---\n gitweb/gitweb.perl |    2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 0f207f2..6d5aeab 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -1556,7 +1556,7 @@ sub sanitize {\n \treturn undef unless defined $str;\n \n \t$str = to_utf8($str);\n-\t$str =~ s|([[:cntrl:]])|($1 =~ /[\\t\\n\\r]/ ? $1 : quot_cec($1))|eg;\n+\t$str =~ s|([[:cntrl:]])|(index(\"\\t\\n\\r\", $1) != -1 ? $1 : quot_cec($1))|eg;\n \treturn $str;\n }\n \n-- \n1.7.10.4\n"}]}