Skip to content

Commit

Permalink
fix(widget handler): sanitize width and height
Browse files Browse the repository at this point in the history
  • Loading branch information
J9rem committed Oct 5, 2021
1 parent df42b08 commit 45f9b84
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tools/templates/handlers/page/widget.php
Expand Up @@ -5,8 +5,12 @@
die("accès direct interdit");
}

$width = (isset($_GET['width'])) ? $_GET['width'] : '100%';
$height = (isset($_GET['height'])) ? $_GET['height'] : 700;
$width = $_GET['width'] ?? '100%';
$height = $_GET['height'] ?? 700;

// sanitize
$width = (preg_match('/^[0-9]+(%|[a-z]{2})?$/m',$width)) ? $width : '100%';
$height = (preg_match('/^[0-9]+(%|[a-z]{2})?$/m',$height)) ? $height : 700;

echo $this->Header();
echo "<h2>"._t('TEMPLATE_WIDGET_TITLE')."</h2>";
Expand Down

0 comments on commit 45f9b84

Please sign in to comment.