66
« Última mensagem por candidosa2 em 06 de Outubro de 2016, 21:59 »
Leia-me
Este patch irá fornecer importantes correções de segurança e bugs no seu 2.0.11 fórum.
changelog
=========
- Injecção de censor palavra fixo, não permitindo uma "palavra apropriada" vazio
- Corrigido unserialize vulneráveis () código, convertendo todas as instâncias para safe_unserialize ()
- Adicionado um safe_unserialize mais completa () para impedir a injeção de objeto
- Corrigido o erro onde deixando um campo de perfil personalizado em branco no registro que tem uma máscara de e-mail iria lançar um erro
- Integração PayPal fixo para cumprir com a sua nova política SSL forçado
- Corrigido o erro onde as notificações foram enviadas para mensagens em placas inacessíveis
- Editor Fixo para fazer o trabalho de editor com o Microsoft Borda
- Corrigido problema onde a janela pop-up do smiley está em branco no iOS 9 dispositivos
- Corrigido editor WYSIWYG em dispositivos móveis
- Corrigido um $ _ POST [ 'icon'] indefinido em Fontes / post.php
- Corrigido um pequeno bug no Login2 ()
- Corrigido um problema onde SMF não reconhece novos nomes de domínio e considera estes como inválida
- Corrigido um problema onde SMF permitiria BBC vazia
- Corrigido um problema onde variantes do tema não poderia ser selecionada
- Corrigido um problema onde a versão do Subs-Post.php arquivo poderia ter sido 2.0.8 ou 2.0.11. Ele será atualizado para 2.0.12 em ambos os casos.
Edições de ficheiro
./index.php
* @version 2.0.11
* @version 2.0.12
$forum_version = 'SMF 2.0.11';
$forum_version = 'SMF 2.0.12';
./Themes/default/languages/index.english.php
// Version: 2.0.10; index
// Version: 2.0.12; index
Esta operação não é vital para a instalação deste mod.
<a href="http://www.simplemachines.org/about/smf/license.php" title="License" target="_blank" class="new_win">SMF © 2015</a>, <a href="http://www.simplemachines.org" title="Simple Machines" target="_blank" class="new_win">Simple Machines</a>';
<a href="http://www.simplemachines.org/about/smf/license.php" title="License" target="_blank" class="new_win">SMF © 2016</a>, <a href="http://www.simplemachines.org" title="Simple Machines" target="_blank" class="new_win">Simple Machines</a>';
./Themes/default/languages/index.english-utf8.php
// Version: 2.0.10; índex
// Version: 2.0.12; index
<a href="http://www.simplemachines.org/about/smf/license.php" title="License" target="_blank" class="new_win">SMF © 2015</a>, <a href="http://www.simplemachines.org" title="Simple Machines" target="_blank" class="new_win">Simple Machines</a>';
<a href="http://www.simplemachines.org/about/smf/license.php" title="License" target="_blank" class="new_win">SMF © 2016</a>, <a href="http://www.simplemachines.org" title="Simple Machines" target="_blank" class="new_win">Simple Machines</a>';
./Sources/Admin.php
@version 2.0
@version 2.0.12
$context['admin_preferences'] = !empty($options['admin_preferences']) ? unserialize($options['admin_preferences']) : array();
$context['admin_preferences'] = !empty($options['admin_preferences']) ? safe_unserialize($options['admin_preferences']) : array();
./Sources/Calendar.php
@version 2.0
@version 2.0.11
$context['clockicons'] = unserialize(base64_decode('YTo2OntzOjI6ImgxIjthOjI6e2k6MDtpOjI7aToxO2k6MTt9czoyOiJoMiI7YTo0OntpOjA7aTo4O2k6MTtpOjQ7aToyO2k6MjtpOjM7aToxO31zOjI6Im0xIjthOjM6e2k6MDtpOjQ7aToxO2k6MjtpOjI7aToxO31zOjI6Im0yIjthOjQ6e2k6MDtpOjg7aToxO2k6NDtpOjI7aToyO2k6MztpOjE7fXM6MjoiczEiO2E6Mzp7aTowO2k6NDtpOjE7aToyO2k6MjtpOjE7fXM6MjoiczIiO2E6NDp7aTowO2k6ODtpOjE7aTo0O2k6MjtpOjI7aTozO2k6MTt9fQ=='));
$context['clockicons'] = safe_unserialize(base64_decode('YTo2OntzOjI6ImgxIjthOjI6e2k6MDtpOjI7aToxO2k6MTt9czoyOiJoMiI7YTo0OntpOjA7aTo4O2k6MTtpOjQ7aToyO2k6MjtpOjM7aToxO31zOjI6Im0xIjthOjM6e2k6MDtpOjQ7aToxO2k6MjtpOjI7aToxO31zOjI6Im0yIjthOjQ6e2k6MDtpOjg7aToxO2k6NDtpOjI7aToyO2k6MztpOjE7fXM6MjoiczEiO2E6Mzp7aTowO2k6NDtpOjE7aToyO2k6MjtpOjE7fXM6MjoiczIiO2E6NDp7aTowO2k6ODtpOjE7aTo0O2k6MjtpOjI7aTozO2k6MTt9fQ=='));
$context['clockicons'] = unserialize(base64_decode('YTozOntzOjE6ImgiO2E6NTp7aTowO2k6MTY7aToxO2k6ODtpOjI7aTo0O2k6MztpOjI7aTo0O2k6MTt9czoxOiJtIjthOjY6e2k6MDtpOjMyO2k6MTtpOjE2O2k6MjtpOjg7aTozO2k6NDtpOjQ7aToyO2k6NTtpOjE7fXM6MToicyI7YTo2OntpOjA7aTozMjtpOjE7aToxNjtpOjI7aTo4O2k6MztpOjQ7aTo0O2k6MjtpOjU7aToxO319'));
$context['clockicons'] = safe_unserialize(base64_decode('YTozOntzOjE6ImgiO2E6NTp7aTowO2k6MTY7aToxO2k6ODtpOjI7aTo0O2k6MztpOjI7aTo0O2k6MTt9czoxOiJtIjthOjY6e2k6MDtpOjMyO2k6MTtpOjE2O2k6MjtpOjg7aTozO2k6NDtpOjQ7aToyO2k6NTtpOjE7fXM6MToicyI7YTo2OntpOjA7aTozMjtpOjE7aToxNjtpOjI7aTo4O2k6MztpOjQ7aTo0O2k6MjtpOjU7aToxO319'));
$context['clockicons'] = unserialize(base64_decode('YTo2OntzOjQ6InllYXIiO2E6Nzp7aTowO2k6NjQ7aToxO2k6MzI7aToyO2k6MTY7aTozO2k6ODtpOjQ7aTo0O2k6NTtpOjI7aTo2O2k6MTt9czo1OiJtb250aCI7YTo0OntpOjA7aTo4O2k6MTtpOjQ7aToyO2k6MjtpOjM7aToxO31zOjM6ImRheSI7YTo1OntpOjA7aToxNjtpOjE7aTo4O2k6MjtpOjQ7aTozO2k6MjtpOjQ7aToxO31zOjQ6ImhvdXIiO2E6NTp7aTowO2k6MTY7aToxO2k6ODtpOjI7aTo0O2k6MztpOjI7aTo0O2k6MTt9czozOiJtaW4iO2E6Njp7aTowO2k6MzI7aToxO2k6MTY7aToyO2k6ODtpOjM7aTo0O2k6NDtpOjI7aTo1O2k6MTt9czozOiJzZWMiO2E6Njp7aTowO2k6MzI7aToxO2k6MTY7aToyO2k6ODtpOjM7aTo0O2k6NDtpOjI7aTo1O2k6MTt9fQ=='));
$context['clockicons'] = safe_unserialize(base64_decode('YTo2OntzOjQ6InllYXIiO2E6Nzp7aTowO2k6NjQ7aToxO2k6MzI7aToyO2k6MTY7aTozO2k6ODtpOjQ7aTo0O2k6NTtpOjI7aTo2O2k6MTt9czo1OiJtb250aCI7YTo0OntpOjA7aTo4O2k6MTtpOjQ7aToyO2k6MjtpOjM7aToxO31zOjM6ImRheSI7YTo1OntpOjA7aToxNjtpOjE7aTo4O2k6MjtpOjQ7aTozO2k6MjtpOjQ7aToxO31zOjQ6ImhvdXIiO2E6NTp7aTowO2k6MTY7aToxO2k6ODtpOjI7aTo0O2k6MztpOjI7aTo0O2k6MTt9czozOiJtaW4iO2E6Njp7aTowO2k6MzI7aToxO2k6MTY7aToyO2k6ODtpOjM7aTo0O2k6NDtpOjI7aTo1O2k6MTt9czozOiJzZWMiO2E6Njp7aTowO2k6MzI7aToxO2k6MTY7aToyO2k6ODtpOjM7aTo0O2k6NDtpOjI7aTo1O2k6MTt9fQ=='));
./Sources/DbPackages-mysql.php
@version 2.0
@version 2.0.12
$unsigned = in_array($type, array('int', 'tinyint', 'smallint', 'mediumint', 'bigint')) && !empty($column['unsigned']) ? 'unsigned ' : '';
$unsigned = in_array($type, array('int', 'tinyint', 'smallint', 'mediumint', 'bigint', 'float')) && !empty($column_info['unsigned']) ? 'unsigned ' : '';
$unsigned = in_array($type, array('int', 'tinyint', 'smallint', 'mediumint', 'bigint')) && !empty($column_info['unsigned']) ? 'unsigned ' : '';
$unsigned = in_array($type, array('int', 'tinyint', 'smallint', 'mediumint', 'bigint', 'float')) && !empty($column_info['unsigned']) ? 'unsigned ' : '';
$unsigned = in_array($type, array('int', 'tinyint', 'smallint', 'mediumint', 'bigint')) && !empty($column_info['unsigned']) ? 'unsigned ' : '';
$unsigned = in_array($type, array('int', 'tinyint', 'smallint', 'mediumint', 'bigint', 'float')) && !empty($column_info['unsigned']) ? 'unsigned ' : '';
./Sources/Display.php
@version 2.0.9
@version 2.0.11
$modSettings['attachmentUploadDir'] = @unserialize($modSettings['attachmentUploadDir']);
$modSettings['attachmentUploadDir'] = safe_unserialize($modSettings['attachmentUploadDir']);
./Sources/Load.php
@version 2.0.11
@version 2.0.12
$integration_settings = unserialize(SMF_INTEGRATION_SETTINGS);
$integration_settings = safe_unserialize(SMF_INTEGRATION_SETTINGS);
$context['display_fields'] = unserialize($modSettings['displayFields']);
$context['display_fields'] = safe_unserialize($modSettings['displayFields']);
return @unserialize($value);
return safe_unserialize($value);
./Sources/LogInOut.php
@version 2.0.11
@version 2.0.12
elseif (!empty($_POST['cookielength']) && ($_POST['cookielength'] >= 1 || $_POST['cookielength'] <= 525600))
elseif (!empty($_POST['cookielength']) && ($_POST['cookielength'] >= 1 && $_POST['cookielength'] <= 525600))
./Sources/ManageAttachments.php
@version 2.0.10
@version 2.0.12
$attach_dirs = unserialize($modSettings['attachmentUploadDir']);
$attach_dirs = safe_unserialize($modSettings['attachmentUploadDir']);
$modSettings['attachmentUploadDir'] = unserialize($modSettings['attachmentUploadDir']);
$modSettings['attachmentUploadDir'] = safe_unserialize($modSettings['attachmentUploadDir']);
$modSettings['attachmentUploadDir'] = unserialize($modSettings['attachmentUploadDir']);
$modSettings['attachmentUploadDir'] = safe_unserialize($modSettings['attachmentUploadDir']);
$modSettings['attachmentUploadDir'] = unserialize($modSettings['attachmentUploadDir']);
$modSettings['attachmentUploadDir'] = safe_unserialize($modSettings['attachmentUploadDir']);
./Sources/ManagePaid.php
@version 2.0.3
@version 2.0.12
'cost' => @unserialize($row['cost']),
'cost' => safe_unserialize($row['cost']),
$pending_details = @unserialize($row['pending_details']);
$pending_details = safe_unserialize($row['pending_details']);
$costs = @unserialize($context['current_subscription']['real_cost']);
$costs = safe_unserialize($context['current_subscription']['real_cost']);
$costs = @unserialize($row['cost']);
$costs = safe_unserialize($row['cost']);
./Sources/ManagePosts.php
if (empty($censor_vulgar[$i]))
continue;
if (empty($censor_proper[$i]))
continue;
./Sources/ManageSearch.php
@version 2.0
@version 2.0.12
$context['index_settings'] = unserialize($modSettings['search_custom_index_resume']);
$context['index_settings'] = safe_unserialize($modSettings['search_custom_index_resume']);
./Sources/ManageServer.php
@version 2.0.10
@version 2.0.12
$context['config_vars'][$config_var[1]]['value'] = !empty($context['config_vars'][$config_var[1]]['value']) ? unserialize($context['config_vars'][$config_var[1]]['value']) : array();
$context['config_vars'][$config_var[1]]['value'] = !empty($context['config_vars'][$config_var[1]]['value']) ? safe_unserialize($context['config_vars'][$config_var[1]]['value']) : array();
./Sources/Memberlist.php
@version 2.0.8
@version 2.0.12
$memberlist_cache = @unserialize($modSettings['memberlist_cache']);
$memberlist_cache = safe_unserialize($modSettings['memberlist_cache']);
./Sources/ModerationCenter.php
@version 2.0.1
@version 2.0.12
$context['admin_preferences'] = !empty($options['admin_preferences']) ? unserialize($options['admin_preferences']) : array();
$context['admin_preferences'] = !empty($options['admin_preferences']) ? safe_unserialize($options['admin_preferences']) : array();
./Sources/Modlog.php
@version 2.0.11
@version 2.0.12
$row['extra'] = @unserialize($row['extra']);
$row['extra'] = safe_unserialize($row['extra']);
./Sources/Packages.php
@version 2.0.11
@version 2.0.12
$db_changes = empty($row['db_changes']) ? array() : unserialize($row['db_changes']);
$db_changes = empty($row['db_changes']) ? array() : safe_unserialize($row['db_changes']);
$theme_data = unserialize(base64_decode($change));
$theme_data = safe_unserialize(base64_decode($change));
$db_changes = empty($row['db_changes']) ? array() : unserialize($row['db_changes']);
$db_changes = empty($row['db_changes']) ? array() : safe_unserialize($row['db_changes']);
$old_db_changes = empty($row['db_changes']) ? array() : unserialize($row['db_changes']);
$old_db_changes = empty($row['db_changes']) ? array() : safe_unserialize($row['db_changes']);
$modSettings['attachmentUploadDir'] = unserialize($modSettings['attachmentUploadDir']);
$modSettings['attachmentUploadDir'] = safe_unserialize($modSettings['attachmentUploadDir']);
./Sources/PersonalMessage.php
@version 2.0.5
@version 2.0.12
'criteria' => unserialize($row['criteria']),
'criteria' => safe_unserialize($row['criteria']),
'actions' => unserialize($row['actions']),
'actions' => safe_unserialize($row['actions']),
./Sources/Post.php
@version 2.0.10
@version 2.0.12
$modSettings['attachmentUploadDir'] = unserialize($modSettings['attachmentUploadDir']);
$modSettings['attachmentUploadDir'] = safe_unserialize($modSettings['attachmentUploadDir']);
$modSettings['attachmentUploadDir'] = unserialize($modSettings['attachmentUploadDir']);
$modSettings['attachmentUploadDir'] = safe_unserialize($modSettings['attachmentUploadDir']);
./Sources/Profile-Actions.php
@version 2.0.6
@version 2.0.12
$costs = @unserialize($sub['real_cost']);
$costs = safe_unserialize($sub['real_cost']);
$current_pending = @unserialize($context['current'][$_GET['sub_id']]['pending_details']);
$current_pending = safe_unserialize($context['current'][$_GET['sub_id']]['pending_details']);
$current_pending = @unserialize($context['current'][$context['sub']['id']]['pending_details']);
$current_pending = safe_unserialize($context['current'][$context['sub']['id']]['pending_details']);
./Sources/Profile-Modify.php
@version 2.0.7
@version 2.0.12
$modSettings['attachmentUploadDir'] = unserialize($modSettings['attachmentUploadDir']);
$modSettings['attachmentUploadDir'] = safe_unserialize($modSettings['attachmentUploadDir']);
./Sources/Profile-View.php
@version 2.0.5
@version 2.0.12
$extra = @unserialize($row['extra']);
$extra = safe_unserialize($row['extra']);
./Sources/Register.php
if ($row['mask'] == 'email' && (preg_match('~^[0-9A-Za-z=_+\-/][0-9A-Za-z=_\'+\-/\.]*@[\w\-]+(\.[\w\-]+)*(\.[\w]{2,6})$~', $value) === 0 || strlen($value) > 255))
if ($row['mask'] == 'email' && !empty($value) && (preg_match('~^[0-9A-Za-z=_+\-/][0-9A-Za-z=_\'+\-/\.]*@[\w\-]+(\.[\w\-]+)*(\.[\w]{2,6})$~', $value) === 0 || strlen($value) > 255))
./Sources/RemoveTopic.php
@version 2.0
@version 2.0.12
$customIndexSettings = unserialize($modSettings['search_custom_index_config']);
$customIndexSettings = safe_unserialize($modSettings['search_custom_index_config']);
$customIndexSettings = unserialize($modSettings['search_custom_index_config']);
$customIndexSettings = safe_unserialize($modSettings['search_custom_index_config']);
./Sources/SearchAPI-Custom.php
@version 2.0
@version 2.0.12
$this->indexSettings = unserialize($modSettings['search_custom_index_config']);
$this->indexSettings = safe_unserialize($modSettings['search_custom_index_config']);
./Sources/Subs-Charset.php
@version 2.0
@version 2.0.12
if (@unserialize($row['extra']) === false && preg_match('~^(a:3:{s:5:"topic";i:\d+;s:7:"subject";s:)(\d+):"(.+)"(;s:6:"member";s:5:"\d+";})$~', $row['extra'], $matches) === 1)
if (safe_unserialize($row['extra']) === false && preg_match('~^(a:3:{s:5:"topic";i:\d+;s:7:"subject";s:)(\d+):"(.+)"(;s:6:"member";s:5:"\d+";})$~', $row['extra'], $matches) === 1)
./Sources/Subs-Graphics.php
@version 2.0.9
@version 2.0.12
$modSettings['attachmentUploadDir'] = unserialize($modSettings['attachmentUploadDir']);
$modSettings['attachmentUploadDir'] = safe_unserialize($modSettings['attachmentUploadDir']);
./Sources/Subs-Members.php
@version 2.0.7
@version 2.0.12
if (empty($regOptions['email']) || preg_match('~^[0-9A-Za-z=_+\-/][0-9A-Za-z=_\'+\-/\.]*@[\w\-]+(\.[\w\-]+)*(\.[\w]{2,6})$~', $regOptions['email'])
if (empty($regOptions['email']) || preg_match('~^[0-9A-Za-z=_+\-/][0-9A-Za-z=_\'+\-/\.]*@[\w\-]+(\.[\w\-]+)*(\.[\w]{2,15})$~', $regOptions['email'])
./Sources/Subs-MembersOnline.php
@version 2.0
@version 2.0.12
$spiders = unserialize($modSettings['spider_name_cache']);
$spiders = safe_unserialize($modSettings['spider_name_cache']);
./Sources/Subs-Menu.php
@version 2.0.1
@version 2.0.12
$menu_context['sections'][$section_id]['areas'][$area_id] = unserialize(base64_decode('YTozOntzOjU6ImxhYmVsIjtzOjEyOiJPb21wYSBMb29tcGEiO3M6MzoidXJsIjtzOjQzOiJodHRwOi8vZW4ud2lraXBlZGlhLm9yZy93aWtpL09vbXBhX0xvb21wYXM/IjtzOjQ6Imljb24iO3M6ODY6IjxpbWcgc3JjPSJodHRwOi8vd3d3LnNpbXBsZW1hY2hpbmVzLm9yZy9pbWFnZXMvb29tcGEuZ2lmIiBhbHQ9IkknbSBhbiBPb21wYSBMb29tcGEiIC8+Ijt9'));
$menu_context['sections'][$section_id]['areas'][$area_id] = safe_unserialize(base64_decode('YTozOntzOjU6ImxhYmVsIjtzOjEyOiJPb21wYSBMb29tcGEiO3M6MzoidXJsIjtzOjQzOiJodHRwOi8vZW4ud2lraXBlZGlhLm9yZy93aWtpL09vbXBhX0xvb21wYXM/IjtzOjQ6Imljb24iO3M6ODY6IjxpbWcgc3JjPSJodHRwOi8vd3d3LnNpbXBsZW1hY2hpbmVzLm9yZy9pbWFnZXMvb29tcGEuZ2lmIiBhbHQ9IkknbSBhbiBPb21wYSBMb29tcGEiIC8+Ijt9'));
./Sources/Subs-Post.php
@version 2.0.8
@version 2.0.12
@version 2.0.10
@version 2.0.12
$criteria = unserialize($row['criteria']);
$criteria = safe_unserialize($row['criteria']);
$customIndexSettings = unserialize($modSettings['search_custom_index_config']);
$customIndexSettings = safe_unserialize($modSettings['search_custom_index_config']);
$modSettings['attachmentUploadDir'] = unserialize($modSettings['attachmentUploadDir']);
$modSettings['attachmentUploadDir'] = safe_unserialize($modSettings['attachmentUploadDir']);
$customIndexSettings = unserialize($modSettings['search_custom_index_config']);
$customIndexSettings = safe_unserialize($modSettings['search_custom_index_config']);
$message = preg_replace_callback('~\[nobbc\](.+?)\[/nobbc\]~is', 'nobbc__preg_callback', $message);
$message = preg_replace_callback('~\[nobbc\](.+?)\[/nobbc\]~is', 'nobbc__preg_callback', $message);
// Remove empty bbc.
$message = preg_replace('~\[([^\]=\s]+)[^\]]*\](?' . '>\s|(?R))*?\[/\1\]\s?~i', '', $message);
./Sources/Subs.php
@version 2.0.11
@version 2.0.12
$modSettings['attachmentUploadDir'] = unserialize($modSettings['attachmentUploadDir']);
$modSettings['attachmentUploadDir'] = safe_unserialize($modSettings['attachmentUploadDir']);
$modSettings['attachmentUploadDir'] = unserialize($modSettings['attachmentUploadDir']);
$modSettings['attachmentUploadDir'] = safe_unserialize($modSettings['attachmentUploadDir']);
function safe_unserialize($data)
{
// There's no reason input should contain an object,
// user is up to no good...
if (preg_match('/(^|;|{|})O:([0-9]|\+|\-)+/', $data) === 0)
return @unserialize($data);
}
/**
* Safe serialize() and unserialize() replacements
*
* @license Public Domain
*
* @author anthon (dot) pang (at) gmail (dot) com
*/
/**
* Safe serialize() replacement. Recursive
* - output a strict subset of PHP's native serialized representation
* - does not serialize objects
*
* @param mixed $value
* @return string
*/
function _safe_serialize($value)
{
if(is_null($value))
return 'N;';
if(is_bool($value))
return 'b:'. (int) $value .';';
if(is_int($value))
return 'i:'. $value .';';
if(is_float($value))
return 'd:'. str_replace(',', '.', $value) .';';
if(is_string($value))
return 's:'. strlen($value) .':"'. $value .'";';
if(is_array($value))
{
$out = '';
foreach($value as $k => $v)
$out .= _safe_serialize($k) . _safe_serialize($v);
return 'a:'. count($value) .':{'. $out .'}';
}
// safe_serialize cannot serialize resources or objects.
return false;
}
/**
* Wrapper for _safe_serialize() that handles exceptions and multibyte encoding issues.
*
* @param mixed $value
* @return string
*/
function safe_serialize($value)
{
// Make sure we use the byte count for strings even when strlen() is overloaded by mb_strlen()
if (function_exists('mb_internal_encoding') &&
(((int) ini_get('mbstring.func_overload')) & 2))
{
$mbIntEnc = mb_internal_encoding();
mb_internal_encoding('ASCII');
}
$out = _safe_serialize($value);
if (isset($mbIntEnc))
mb_internal_encoding($mbIntEnc);
return $out;
}
/**
* Safe unserialize() replacement
* - accepts a strict subset of PHP's native serialized representation
* - does not unserialize objects
*
* @param string $str
* @return mixed
* @throw Exception if $str is malformed or contains unsupported types (e.g., resources, objects)
*/
function _safe_unserialize($str)
{
// Input exceeds 4096.
if(strlen($str) > 4096)
return false;
// Input is not a string.
if(empty($str) || !is_string($str))
return false;
$stack = array();
$expected = array();
/*
* states:
* 0 - initial state, expecting a single value or array
* 1 - terminal state
* 2 - in array, expecting end of array or a key
* 3 - in array, expecting value or another array
*/
$state = 0;
while($state != 1)
{
$type = isset($str[0]) ? $str[0] : '';
if($type == '}')
$str = substr($str, 1);
else if($type == 'N' && $str[1] == ';')
{
$value = null;
$str = substr($str, 2);
}
else if($type == 'b' && preg_match('/^b:([01]);/', $str, $matches))
{
$value = $matches[1] == '1' ? true : false;
$str = substr($str, 4);
}
else if($type == 'i' && preg_match('/^i:(-?[0-9]+);(.*)/s', $str, $matches))
{
$value = (int)$matches[1];
$str = $matches[2];
}
else if($type == 'd' && preg_match('/^d:(-?[0-9]+\.?[0-9]*(E[+-][0-9]+)?);(.*)/s', $str, $matches))
{
$value = (float)$matches[1];
$str = $matches[3];
}
else if($type == 's' && preg_match('/^s:([0-9]+):"(.*)/s', $str, $matches) && substr($matches[2], (int)$matches[1], 2) == '";')
{
$value = substr($matches[2], 0, (int)$matches[1]);
$str = substr($matches[2], (int)$matches[1] + 2);
}
else if($type == 'a' && preg_match('/^a:([0-9]+):{(.*)/s', $str, $matches) && $matches[1] < 256)
{
$expectedLength = (int)$matches[1];
$str = $matches[2];
}
// Object or unknown/malformed type.
else
return false;
switch($state)
{
case 3: // In array, expecting value or another array.
if($type == 'a')
{
// Array nesting exceeds 3.
if(count($stack) >= 3)
return false;
$stack[] = &$list;
$list[$key] = array();
$list = &$list[$key];
$expected[] = $expectedLength;
$state = 2;
break;
}
if($type != '}')
{
$list[$key] = $value;
$state = 2;
break;
}
// Missing array value.
return false;
case 2: // in array, expecting end of array or a key
if($type == '}')
{
// Array size is less than expected.
if(count($list) < end($expected))
return false;
unset($list);
$list = &$stack[count($stack)-1];
array_pop($stack);
// Go to terminal state if we're at the end of the root array.
array_pop($expected);
if(count($expected) == 0)
$state = 1;
break;
}
if($type == 'i' || $type == 's')
{
// Array size exceeds 256.
if(count($list) >= 256)
return false;
// Array size exceeds expected length.
if(count($list) >= end($expected))
return false;
$key = $value;
$state = 3;
break;
}
// Illegal array index type.
return false;
// Expecting array or value.
case 0:
if($type == 'a')
{
// Array nesting exceeds 3.
if(count($stack) >= 3)
return false;
$data = array();
$list = &$data;
$expected[] = $expectedLength;
$state = 2;
break;
}
if($type != '}')
{
$data = $value;
$state = 1;
break;
}
// Not in array.
return false;
}
}
// Trailing data in input.
if(!empty($str))
return false;
return $data;
}
/**
* Wrapper for _safe_unserialize() that handles exceptions and multibyte encoding issue
*
* @param string $str
* @return mixed
*/
function safe_unserialize($str)
{
// Make sure we use the byte count for strings even when strlen() is overloaded by mb_strlen()
if (function_exists('mb_internal_encoding') &&
(((int) ini_get('mbstring.func_overload')) & 0x02))
{
$mbIntEnc = mb_internal_encoding();
mb_internal_encoding('ASCII');
}
$out = _safe_unserialize($str);
if (isset($mbIntEnc))
mb_internal_encoding($mbIntEnc);
return $out;
}
./Sources/Subscriptions-PayPal.php
if (function_exists('curl_init') && $curl = curl_init((!empty($modSettings['paidsubs_test']) ? 'https://www.sandbox.' : 'http://www.') . 'paypal.com/cgi-bin/webscr'))
if (function_exists('curl_init') && $curl = curl_init((!empty($modSettings['paidsubs_test']) ? 'https://www.sandbox.' : 'https://www.') . 'paypal.com/cgi-bin/webscr'))
$fp = fsockopen('www.paypal.com', 80, $errno, $errstr, 30);
$fp = fsockopen('ssl://www.paypal.com', 443, $errno, $errstr, 30);
./Sources/Themes.php
@version 2.0.4
@version 2.0.12
$install_info += unserialize($match[1]);
$install_info += safe_unserialize($match[1]);
$options['admin_preferences'] = !empty($options['admin_preferences']) ? unserialize($options['admin_preferences']) : array();
$options['admin_preferences'] = !empty($options['admin_preferences']) ? safe_unserialize($options['admin_preferences']) : array();
updateMemberData((int) $_REQUEST['u'], array('id_theme' => (int) $_GET['th']));
if (isset($_GET['th']) && $_GET['th'] == 0)
$_GET['th'] = $modSettings['theme_guests'];
updateMemberData((int) $_REQUEST['u'], array('id_theme' => (int) $_GET['th']));
./Sources/Who.php
@version 2.0.2
@version 2.0.12
$actions = @unserialize($row['url']);
$actions = safe_unserialize($row['url']);
foreach (unserialize($modSettings['spider_name_cache']) as $id => $name)
foreach (safe_unserialize($modSettings['spider_name_cache']) as $id => $name)
$actions = @unserialize($url[0]);
$actions = safe_unserialize($url[0]);
./subscriptions.php
@version 2.0.2
@version 2.0.12
$cost = unserialize($subscription_info['cost']);
$cost = safe_unserialize($subscription_info['cost']);
$real_details = @unserialize($subscription_info['pending_details']);
$real_details = safe_unserialize($subscription_info['pending_details']);
./Themes/default/scripts/editor.js
oMyStyle.styleSheet.cssText = document.styleSheets['editor_ie_css'] ? document.styleSheets['editor_ie_css'].cssText : document.styleSheets['editor_css'].cssText;
if (oMyStyle.styleSheet)
oMyStyle.styleSheet.cssText = document.styleSheets['editor_ie_css'] ? document.styleSheets['editor_ie_css'].cssText : document.styleSheets['editor_css'].cssText;
else
oMyStyle.sheet.cssText = document.styleSheets['editor_ie_css'] ? document.styleSheets['editor_ie_css'].cssText : document.styleSheets['editor_css'].cssText;
this.oSmileyPopupWindow = window.open('about:blank', this.opt.sUniqueId + '_addMoreSmileysPopup', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,width=480,height=220,resizable=yes');
this.oSmileyPopupWindow = window.open('', this.opt.sUniqueId + '_addMoreSmileysPopup', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,width=480,height=220,resizable=yes');
this.bRichTextPossible = !this.opt.bRichEditOff && ((is_ie5up && !is_ie50) || is_ff || is_opera95up || is_safari || is_chrome) && !(is_iphone || is_android);
this.bRichTextPossible = !this.opt.bRichEditOff && ((is_ie5up && !is_ie50) || is_ff || is_opera95up || is_safari || is_chrome);
./Themes/default/Themes.template.php
@version 2.0.7
@version 2.0.12
<a href="', $scripturl, '?action=theme;sa=pick;u=', $context['current_member'], ';th=', $theme['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $theme['name'], '</a>
<a href="', $scripturl, '?action=theme;sa=pick;u=', $context['current_member'], ';th=', $theme['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $theme['name'], (!empty($theme['variants']) ? ';vrt=' . $theme['selected_variant'] : ''), '</a>
<li>
<a href="', $scripturl, '?action=theme;sa=pick;u=', $context['current_member'], ';th=', $theme['id'], ';', $context['session_var'], '=', $context['session_id'], '" id="theme_use_', $theme['id'], '">[', $txt['theme_set'], ']</a>
</li>
<li>
<a href="', $scripturl, '?action=theme;sa=pick;u=', $context['current_member'], ';theme=', $theme['id'], ';', $context['session_var'], '=', $context['session_id'], '" id="theme_preview_', $theme['id'], '">[', $txt['theme_preview'], ']</a>
</li>
<li>
<a href="', $scripturl, '?action=theme;sa=pick;u=', $context['current_member'], ';th=', $theme['id'], ';', $context['session_var'], '=', $context['session_id'], (!empty($theme['variants']) ? ';vrt=' . $theme['selected_variant'] : ''), '" id="theme_use_', $theme['id'], '">[', $txt['theme_set'], ']</a>
</li>
<li>
<a href="', $scripturl, '?action=theme;sa=pick;u=', $context['current_member'], ';theme=', $theme['id'], ';', $context['session_var'], '=', $context['session_id'], (!empty($theme['variants']) ? ';vrt=' . $theme['selected_variant'] : ''), '" id="theme_preview_', $theme['id'], '">[', $txt['theme_preview'], ']</a>
</li>