summaryrefslogtreecommitdiffstats
path: root/system/core/Security.php
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2013-09-25 15:03:59 +0200
committerFlorian Pritz <bluewind@xinu.at>2013-09-25 15:03:59 +0200
commit6705e6c987b6e4a43bbb666c33d8fc8a0ef1a0a6 (patch)
treeb815871f7f031633c400a33cf5d6245282d59955 /system/core/Security.php
parent50230001eb5387b6b0ff7ce906d074ef4a530d11 (diff)
parentab98249a9a087745b29e5cb258ea0b624f12f64b (diff)
Merge branch 'working'
Diffstat (limited to 'system/core/Security.php')
-rw-r--r--[-rwxr-xr-x]system/core/Security.php13
1 files changed, 6 insertions, 7 deletions
diff --git a/system/core/Security.php b/system/core/Security.php
index 00089d765..b0d39b981 100755..100644
--- a/system/core/Security.php
+++ b/system/core/Security.php
@@ -619,17 +619,16 @@ class CI_Security {
$count = 0;
$attribs = array();
- // find occurrences of illegal attribute strings without quotes
- preg_match_all('/('.implode('|', $evil_attributes).')\s*=\s*([^\s>]*)/is', $str, $matches, PREG_SET_ORDER);
+ // find occurrences of illegal attribute strings with quotes (042 and 047 are octal quotes)
+ preg_match_all('/('.implode('|', $evil_attributes).')\s*=\s*(\042|\047)([^\\2]*?)(\\2)/is', $str, $matches, PREG_SET_ORDER);
foreach ($matches as $attr)
{
-
$attribs[] = preg_quote($attr[0], '/');
}
- // find occurrences of illegal attribute strings with quotes (042 and 047 are octal quotes)
- preg_match_all("/(".implode('|', $evil_attributes).")\s*=\s*(\042|\047)([^\\2]*?)(\\2)/is", $str, $matches, PREG_SET_ORDER);
+ // find occurrences of illegal attribute strings without quotes
+ preg_match_all('/('.implode('|', $evil_attributes).')\s*=\s*([^\s>]*)/is', $str, $matches, PREG_SET_ORDER);
foreach ($matches as $attr)
{
@@ -639,7 +638,7 @@ class CI_Security {
// replace illegal attribute strings that are inside an html tag
if (count($attribs) > 0)
{
- $str = preg_replace("/<(\/?[^><]+?)([^A-Za-z<>\-])(.*?)(".implode('|', $attribs).")(.*?)([\s><])([><]*)/i", '<$1 $3$5$6$7', $str, -1, $count);
+ $str = preg_replace('/(<?)(\/?[^><]+?)([^A-Za-z<>\-])(.*?)('.implode('|', $attribs).')(.*?)([\s><]?)([><]*)/i', '$1$2 $4$6$7$8', $str, -1, $count);
}
} while ($count);
@@ -873,4 +872,4 @@ class CI_Security {
}
/* End of file Security.php */
-/* Location: ./system/libraries/Security.php */ \ No newline at end of file
+/* Location: ./system/libraries/Security.php */