Skip to content
Extraits de code Groupes Projets
Valider 2d06c9a7 rédigé par Matthieu Napoli's avatar Matthieu Napoli
Parcourir les fichiers

Fix for bd7dc4d6 which broke the build (null bytes where not sanitized)

parent 726ffad5
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -314,6 +314,8 @@ class Common
// note: before php 5.2.7, htmlspecialchars() double encodes &#x hex items
$value = html_entity_decode($value, self::HTML_ENCODING_QUOTE_STYLE, 'UTF-8');
$value = self::sanitizeNullBytes($value);
// escape
$tmp = @htmlspecialchars($value, self::HTML_ENCODING_QUOTE_STYLE, 'UTF-8');
......@@ -383,13 +385,21 @@ class Common
}
/**
*
* @param string
* @param string $value
* @return string Line breaks and line carriage removed
*/
public static function sanitizeLineBreaks($value)
{
return str_replace(array("\n", "\r", "\0"), '', $value);
return str_replace(array("\n", "\r"), '', $value);
}
/**
* @param string $value
* @return string Null bytes removed
*/
public static function sanitizeNullBytes($value)
{
return str_replace(array("\0"), '', $value);
}
/**
......
......@@ -55,8 +55,8 @@ class Core_CommonTest extends PHPUnit_Framework_TestCase
),
// test filter - expect new line and null byte to be filtered out
array(
"New\nLine\rNull\0Byte",
'NewLineNullByte'
"Null\0Byte",
'NullByte'
),
// double encoded - no change (document as user error)
array(
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter