threads / patch / 4975

patchgitweb: escape tag comments

Subject: [PATCH] gitweb: escape tag comments

## tl;dr

One message between Jul 24, 2006 and Jul 24, 2006. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Daniel Drake· Jul 24, 2006, 22:07 UTC · lore

I have a tag with a comment which includes an & character. Firefox wouldn't display my gitweb summary page due to malformed XML. This solves the problem.

Signed-off-by: Daniel Drake <dsd@gentoo.org>
Show changes to gitweb/gitweb.cgi +1 −1
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index 2fd1e5f..5acd66d 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -1138,7 +1138,7 @@ sub git_summary {
 				      "</td>\n" .
 				      "<td>";
 				if (defined($comment)) {
-				      print $cgi->a({-class => "list", -href => "$my_uri?" . esc_param("p=$project;a=tag;h=$tag{'id'}")}, $comment);
+				      print $cgi->a({-class => "list", -href => "$my_uri?" . esc_param("p=$project;a=tag;h=$tag{'id'}")}, esc_html($comment));
 				}
 				print "</td>\n" .
 				      "<td class=\"link\">";

← back to recent threads