Welcome Guest, Not a member yet? Register   Sign In
permitted_uri_chars and $_GET
#29

[eluser]Edemilson Lima[/eluser]
I don't know exactly what is wrong. What error message do you got?
The line that check this in CI is at /system/libraries/URI.php:
Code:
if ( ! preg_match("|^[".preg_quote($this->config->item('permitted_uri_chars'))."]+$|i", $str))
{
  exit('The URI you submitted has disallowed characters.');
}
Looking at this line, I see that is not necessary to escape the special characters. The preg_quote() function will do this for you. But I don't know why they used preg_match() to do this. It could be done with an eregi() instead. Maybe preg_match() is faster, I don't know. If you look at the line above you will notice that the allowed characters string is enclosed between the brackets "[" and "]". In a regular expression, some special characters work different when enclosed by brackets. The minus (-) sign is to specify a sequence of characters in the ASCII table. For example "a-z" (all letters from A to Z) or "0-9" (all digits from zero to nine). To use the minus as an allowed character you must place it at the end of the string. The other special characters (except the "^" in the beggining of the string enclosed in brackets) are not considered special.

We could try to change the line above to:
Code:
if ( ! eregi("^[".$this->config->item('permitted_uri_chars'))."]+$", $str))
May it works as expected, allowing only the characters in the string, but make changes in a core library is not the best thing to do.


Messages In This Thread
permitted_uri_chars and $_GET - by El Forum - 02-11-2008, 03:50 PM
permitted_uri_chars and $_GET - by El Forum - 02-11-2008, 05:45 PM
permitted_uri_chars and $_GET - by El Forum - 02-11-2008, 07:02 PM
permitted_uri_chars and $_GET - by El Forum - 02-12-2008, 03:12 AM
permitted_uri_chars and $_GET - by El Forum - 02-12-2008, 06:12 AM
permitted_uri_chars and $_GET - by El Forum - 02-12-2008, 06:25 AM
permitted_uri_chars and $_GET - by El Forum - 02-12-2008, 06:49 AM
permitted_uri_chars and $_GET - by El Forum - 02-12-2008, 07:04 AM
permitted_uri_chars and $_GET - by El Forum - 02-12-2008, 07:26 AM
permitted_uri_chars and $_GET - by El Forum - 02-12-2008, 07:37 AM
permitted_uri_chars and $_GET - by El Forum - 02-12-2008, 04:20 PM
permitted_uri_chars and $_GET - by El Forum - 02-12-2008, 05:41 PM
permitted_uri_chars and $_GET - by El Forum - 02-19-2008, 12:56 AM
permitted_uri_chars and $_GET - by El Forum - 02-19-2008, 07:27 AM
permitted_uri_chars and $_GET - by El Forum - 02-19-2008, 10:40 AM
permitted_uri_chars and $_GET - by El Forum - 02-19-2008, 11:22 AM
permitted_uri_chars and $_GET - by El Forum - 02-20-2008, 08:01 AM
permitted_uri_chars and $_GET - by El Forum - 02-20-2008, 10:28 AM
permitted_uri_chars and $_GET - by El Forum - 02-20-2008, 08:18 PM
permitted_uri_chars and $_GET - by El Forum - 02-20-2008, 08:23 PM
permitted_uri_chars and $_GET - by El Forum - 02-20-2008, 08:29 PM
permitted_uri_chars and $_GET - by El Forum - 02-20-2008, 08:38 PM
permitted_uri_chars and $_GET - by El Forum - 02-20-2008, 08:47 PM
permitted_uri_chars and $_GET - by El Forum - 02-21-2008, 07:41 AM
permitted_uri_chars and $_GET - by El Forum - 02-21-2008, 08:33 AM
permitted_uri_chars and $_GET - by El Forum - 02-21-2008, 11:32 AM
permitted_uri_chars and $_GET - by El Forum - 02-21-2008, 11:59 AM
permitted_uri_chars and $_GET - by El Forum - 02-21-2008, 12:16 PM
permitted_uri_chars and $_GET - by El Forum - 02-21-2008, 01:28 PM
permitted_uri_chars and $_GET - by El Forum - 02-21-2008, 01:49 PM
permitted_uri_chars and $_GET - by El Forum - 02-21-2008, 03:07 PM
permitted_uri_chars and $_GET - by El Forum - 02-21-2008, 03:14 PM
permitted_uri_chars and $_GET - by El Forum - 09-02-2008, 06:12 PM
permitted_uri_chars and $_GET - by El Forum - 09-02-2008, 07:55 PM
permitted_uri_chars and $_GET - by El Forum - 09-02-2008, 09:29 PM
permitted_uri_chars and $_GET - by El Forum - 09-02-2008, 10:29 PM
permitted_uri_chars and $_GET - by El Forum - 09-03-2008, 12:29 AM
permitted_uri_chars and $_GET - by El Forum - 09-03-2008, 02:16 AM
permitted_uri_chars and $_GET - by El Forum - 09-03-2008, 02:47 AM
permitted_uri_chars and $_GET - by El Forum - 09-03-2008, 11:00 AM
permitted_uri_chars and $_GET - by El Forum - 04-20-2009, 11:46 PM
permitted_uri_chars and $_GET - by El Forum - 04-21-2009, 12:49 AM



Theme © iAndrew 2016 - Forum software by © MyBB