Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite fix issue #33 #902

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 14 additions & 6 deletions system/core/Input.php
Expand Up @@ -498,7 +498,7 @@ protected function _sanitize_globals()

foreach ($_COOKIE as $key => $val)
{
$_COOKIE[$this->_clean_input_keys($key)] = $this->_clean_input_data($val);
$_COOKIE[$this->_clean_input_keys($key, TRUE)] = $this->_clean_input_data($val, TRUE);
}
}

Expand All @@ -525,14 +525,14 @@ protected function _sanitize_globals()
* @param string
* @return string
*/
protected function _clean_input_data($str)
protected function _clean_input_data($str, $cookie = FALSE)
{
if (is_array($str))
{
$new_array = array();
foreach ($str as $key => $val)
{
$new_array[$this->_clean_input_keys($key)] = $this->_clean_input_data($val);
$new_array[$this->_clean_input_keys($key, $cookie)] = $this->_clean_input_data($val, $cookie);
}
return $new_array;
}
Expand Down Expand Up @@ -583,12 +583,20 @@ protected function _clean_input_data($str)
* @param string
* @return string
*/
protected function _clean_input_keys($str)
protected function _clean_input_keys($str, $cookie = FALSE)
{
if ( ! preg_match('/^[a-z0-9:_\/-]+$/i', $str))
{
set_status_header(503);
exit('Disallowed Key Characters.');
// If $cookie true we will unset it
if ($cookie)
{
unset($_COOKIE[$str]);
}
else
{
set_status_header(503);
exit('Disallowed Key Characters.');
}
}

// Clean UTF-8 if supported
Expand Down
1 change: 1 addition & 0 deletions user_guide_src/source/changelog.rst
Expand Up @@ -123,6 +123,7 @@ Bug fixes for 3.0
- Fixed a bug (#638) - db_set_charset() ignored its arguments and always used the configured charset and collation instead.
- Fixed a bug (#413) - Oracle's _error_message() and _error_number() methods used to only return connection-related errors.
- Fixed a bug (#804) - Profiler library was trying to handle objects as strings in some cases, resulting in warnings being issued by htmlspecialchars().
- Fixed a bug (#33) - CodeIgniter attempts to validate data it didn't create and crashes.

Version 2.1.1
=============
Expand Down