Autocomplete: Escape HTML tags in callback name to avoid XSS in demo

Fixes #15048
This commit is contained in:
Scott González 2016-09-22 07:53:22 -04:00
parent c571d2f234
commit 69e66ea655

View File

@ -586,7 +586,10 @@ foreach ($items as $key=>$value) {
$output = json_encode($result); $output = json_encode($result);
if ($_GET["callback"]) { if ($_GET["callback"]) {
$output = $_GET["callback"] . "($output);"; // Escape special characters to avoid XSS attacks via direct loads of this
// page with a callback that contains HTML. This is a lot easier than validating
// the callback name.
$output = htmlspecialchars($_GET["callback"]) . "($output);";
} }
echo $output; echo $output;