mirror of
https://github.com/phpbb/phpbb.git
synced 2025-03-24 09:30:34 +01:00
[ticket/security/243] Limit size values to supported values
SECURITY-243
This commit is contained in:
parent
9e9bdb69b5
commit
b5a997ce18
@ -139,6 +139,7 @@ $lang = array_merge($lang, array(
|
||||
'IMAGES_ARE_OFF' => '[img] is <em>OFF</em>',
|
||||
'IMAGES_ARE_ON' => '[img] is <em>ON</em>',
|
||||
'INVALID_FILENAME' => '%s is an invalid filename.',
|
||||
'INVALID_FONT_SIZE' => 'The font size you supplied is invalid: %s',
|
||||
|
||||
'LOAD' => 'Load',
|
||||
'LOAD_DRAFT' => 'Load draft',
|
||||
|
@ -228,6 +228,10 @@ class parser implements \phpbb\textformatter\parser_interface
|
||||
{
|
||||
$errors[] = array($msg);
|
||||
}
|
||||
else if ($msg === 'INVALID_FONT_SIZE')
|
||||
{
|
||||
$errors[] = [$msg, $context['invalid_size']];
|
||||
}
|
||||
}
|
||||
|
||||
// Deduplicate error messages. array_unique() only works on strings so we have to serialize
|
||||
@ -335,6 +339,13 @@ class parser implements \phpbb\textformatter\parser_interface
|
||||
*/
|
||||
static public function filter_font_size($size, $max_size, Logger $logger)
|
||||
{
|
||||
if (!is_int($size))
|
||||
{
|
||||
$logger->err('INVALID_FONT_SIZE', ['invalid_size' => htmlspecialchars($size)]);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($max_size && $size > $max_size)
|
||||
{
|
||||
$logger->err('MAX_FONT_SIZE_EXCEEDED', array('max_size' => $max_size));
|
||||
|
Loading…
x
Reference in New Issue
Block a user