git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eddie Kohler <kohler@cs.ucla.edu>
To: git@vger.kernel.org
Subject: gitweb: get_file_owner and XML special characters
Date: Tue, 17 Jul 2007 13:06:37 -0700	[thread overview]
Message-ID: <469D214D.7030101@cs.ucla.edu> (raw)

[-- Attachment #1: Type: text/plain, Size: 351 bytes --]

Hi,

I think current gitweb generates invalid XHTML when get_file_owner returns a 
string containing <>&.  (Version 1.5.2.1 certainly does, and in a quick browse 
of current source I didn't notice relevant changes.)

Here is a dirty patch to fix this problem.  Apologies if it is no longer a 
problem or if the patch is gross.
Thanks,
Eddie (newbie)


[-- Attachment #2: 0001-Escape-HTML-special-characters-in-file-owner.patch --]
[-- Type: text/x-patch, Size: 687 bytes --]

>From 1c6ba7b6b28808cea0f2f9ab46733ddefdac329a Mon Sep 17 00:00:00 2001
From: Eddie Kohler <kohler@cs.ucla.edu>
Date: Tue, 17 Jul 2007 13:06:08 -0700
Subject: [PATCH] Escape HTML special characters in file owner

---
 gitweb/gitweb.perl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index c8ba3a2..540d9a6 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2050,7 +2050,7 @@ sub get_file_owner {
 	}
 	my $owner = $gcos;
 	$owner =~ s/[,;].*$//;
-	return to_utf8($owner);
+	return $cgi->escapeHTML(to_utf8($owner));
 }
 
 ## ......................................................................
-- 
1.5.2.2


                 reply	other threads:[~2007-07-17 20:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=469D214D.7030101@cs.ucla.edu \
    --to=kohler@cs.ucla.edu \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).