Securing $misc->href
authorJehan-Guillaume (ioguix) de Rorthais <ioguix@free.fr>
Fri, 16 Dec 2011 23:25:10 +0000 (00:25 +0100)
committerJehan-Guillaume (ioguix) de Rorthais <ioguix@free.fr>
Thu, 29 Dec 2011 19:50:43 +0000 (20:50 +0100)
See http://php.net/manual/en/function.urlencode.php
This is only used in href parameter of A tag and should be escaped
properly.

classes/Misc.php

index 3a04ddc7d3f23d728286d88b079e6d059d742c3c..49774ff6f56e4deea3b7057f5a8260f53c149679 100644 (file)
                        if (isset($_REQUEST['server']) && $exclude_from != 'server') {
                                $href .= 'server=' . urlencode($_REQUEST['server']);
                                if (isset($_REQUEST['database']) && $exclude_from != 'database') {
-                                       $href .= '&amp;database=' . urlencode($_REQUEST['database']);
+                                       $href .= '&database=' . urlencode($_REQUEST['database']);
                                        if (isset($_REQUEST['schema']) && $exclude_from != 'schema') {
-                                               $href .= '&amp;schema=' . urlencode($_REQUEST['schema']);
+                                               $href .= '&schema=' . urlencode($_REQUEST['schema']);
                                        }
                                }
                        }
-                       return $href;
+                       return htmlentities($href);
                }
 
                /**