source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mandoc.bsd.lv
To: source@mandoc.bsd.lv
Subject: cvsweb: more XSS prevention; patch from afresh1@; also triggered by the
Date: Thu, 21 Mar 2019 18:08:44 -0500 (EST)	[thread overview]
Message-ID: <e3fc8820a0f52755@fantadrom.bsd.lv> (raw)

Log Message:
-----------
more XSS prevention; patch from afresh1@;
also triggered by the report from Ezio Paglia

Tags:
----
FreeBSD-cvsweb-2_0-branch

Modified Files:
--------------
    cvsweb:
        cvsweb.cgi

Revision Data
-------------
Index: cvsweb.cgi
===================================================================
RCS file: /home/cvs/mandoc/cvsweb/cvsweb.cgi,v
retrieving revision 3.119.2.15
retrieving revision 3.119.2.16
diff -Lcvsweb.cgi -Lcvsweb.cgi -u -p -r3.119.2.15 -r3.119.2.16
--- cvsweb.cgi
+++ cvsweb.cgi
@@ -2842,7 +2842,7 @@ sub doLog($) {
 	print $sel;
 	print "</select>\n";
 	$diffrev = $revdisplayorder[$#revdisplayorder];
-	$diffrev = $input{"r1"} if (defined($input{"r1"}));
+	$diffrev = htmlquote($input{"r1"}) if (defined($input{"r1"}));
 	print
 	    "<input type=\"text\" size=\"$inputTextSize\" name=\"tr1\" value=\"$diffrev\" onchange=\"this.form.r1.selectedIndex=0\"></td>\n";
 	print "<td><br></td>\n</tr>\n";
@@ -2853,7 +2853,7 @@ sub doLog($) {
 	print $sel;
 	print "</select>\n";
 	$diffrev = $revdisplayorder[0];
-	$diffrev = $input{"r2"} if (defined($input{"r2"}));
+	$diffrev = htmlquote($input{"r2"}) if (defined($input{"r2"}));
 	print
 	    "<input type=\"text\" size=\"$inputTextSize\" name=\"tr2\" value=\"$diffrev\" onchange=\"this.form.r2.selectedIndex=0\"></td>\n";
 	print "<td><input type=\"submit\" value=\"  Get Diffs  \" accesskey=\"G\"></td>\n";
@@ -2898,7 +2898,8 @@ sub doLog($) {
 		next if ($_ eq "f");
 		next if ($_ eq "only_with_tag");
 		next if ($_ eq "logsort");
-		print "<input type=\"hidden\" name=\"$_\" value=\"$input{$_}\">\n"
+		printf "<input type=\"hidden\" name=\"%s\" value=\"%s\">\n",
+		    $_, htmlquote($input{$_})
 		    if (defined($input{$_})
 		    && (!defined($DEFAULTVALUE{$_})
 		    || $input{$_} ne $DEFAULTVALUE{$_}) && $input{$_} ne "");
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv

                 reply	other threads:[~2019-03-21 23:08 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=e3fc8820a0f52755@fantadrom.bsd.lv \
    --to=schwarze@mandoc.bsd.lv \
    --cc=source@mandoc.bsd.lv \
    /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).