Commits

Bogdan Savluk committed 4a204c3

updated spellchecker

  • Participants
  • Parent commits 6e474a4

Comments (0)

Files changed (4)

vendors/tinymce/spellchecker/changelog.txt

+Version 2.0.6.1 (2012-11-20)
+	Fixed security issue with google spellchecker.
 Version 2.0.6 (2011-09-29)
 	Fixed incorrect position of suggestion menu.
 	Fixed handling of mispelled words with no suggestions in PSpellShell engine.

vendors/tinymce/spellchecker/classes/GoogleSpell.php

  *
  * @package MCManager.includes
  * @author Moxiecode
- * @copyright Copyright ďż˝ 2004-2007, Moxiecode Systems AB, All rights reserved.
+ * @copyright Copyright Š 2004-2007, Moxiecode Systems AB, All rights reserved.
  */
 
 class GoogleSpell extends SpellChecker {
 		$matches = $this->_getMatches($lang, $word);
 
 		if (count($matches) > 0)
-			$sug = explode("\t", /*utf8_encode*/($this->_unhtmlentities($matches[0][4])));
+			$sug = explode("\t", utf8_encode($this->_unhtmlentities($matches[0][4])));
 
 		// Remove empty
 		foreach ($sug as $item) {
 		return $osug;
 	}
 
-	function &_getMatches($lang, $str) {
+	protected function &_getMatches($lang, $str) {
+		$lang = preg_replace('/[^a-z\-]/i', '', $lang); // Sanitize, remove everything but a-z or -
+		$str = preg_replace('/[\x00-\x1F\x7F]/', '', $str); // Sanitize, remove all control characters
 		$server = "www.google.com";
 		$port = 443;
 		$path = "/tbproxy/spell?lang=" . $lang . "&hl=en";
 		return $matches;
 	}
 
-	function _unhtmlentities($string) {
+	protected function _unhtmlentities($string) {
 		$string = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $string);
 		$string = preg_replace('~&#([0-9]+);~e', 'chr(\\1)', $string);
 

vendors/tinymce/spellchecker/classes/PSpellShell.php

  *
  * @package MCManager.includes
  * @author Moxiecode
- * @copyright Copyright ďż˝ 2004-2007, Moxiecode Systems AB, All rights reserved.
+ * @copyright Copyright Š 2004-2007, Moxiecode Systems AB, All rights reserved.
  */
 
 class PSpellShell extends SpellChecker {

vendors/tinymce/spellchecker/classes/SpellChecker.php

  *
  * @package MCManager.includes
  * @author Moxiecode
- * @copyright Copyright ďż˝ 2004-2007, Moxiecode Systems AB, All rights reserved.
+ * @copyright Copyright Š 2004-2007, Moxiecode Systems AB, All rights reserved.
  */
 
 class SpellChecker {
 	/**
 	 * Constructor.
 	 *
-	 * @param $config array name/value array.
+	 * @param $config Configuration name/value array.
 	 */
 	function SpellChecker(&$config) {
 		$this->_config = $config;