]> xenbits.xensource.com Git - libvirt.git/commitdiff
docs: Properly quote self uri in search.php
authorMartin Kletzander <mkletzan@redhat.com>
Mon, 10 Jul 2017 09:47:49 +0000 (11:47 +0200)
committerMartin Kletzander <mkletzan@redhat.com>
Mon, 10 Jul 2017 11:44:00 +0000 (13:44 +0200)
This removes the classical XSS vulnerability of using unquoted
PHP_SELF.

Reported-by: John Lightsey <john@nixnuts.net>
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
docs/search.php.code.in

index c7511c3782553ba3082a17c2e3e0ded4e6fc8566..3c66f94ca5b7249970d19eb95b6bbcc16011429b 100644 (file)
@@ -12,7 +12,7 @@
     $querystr = htmlspecialchars($query, ENT_QUOTES, 'UTF-8');
 ?>
 
-<form action="<?php echo $_SERVER['PHP_SELF'], "?query=", rawurlencode($query) ?>"
+<form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8'), "?query=", rawurlencode($query) ?>"
       enctype="application/x-www-form-urlencoded" method="get">
   <input name="query" type="text" size="50" value="<?php echo $querystr ?>"/>
   <select name="scope">