diff options
author | Christian Schneider | 2007-11-09 15:16:24 +0000 |
---|---|---|
committer | Christian Schneider | 2007-11-09 15:16:24 +0000 |
commit | 0f3e763209348e6b1e34be71716029b8faaa0caf (patch) | |
tree | 4a5f80b53b026aec80d0b2193fae88b8db92fe3c /it_html.class | |
parent | 1214316cbf8d2e9c71d445ddb83184316f568394 (diff) | |
download | itools-0f3e763209348e6b1e34be71716029b8faaa0caf.tar.gz itools-0f3e763209348e6b1e34be71716029b8faaa0caf.tar.bz2 itools-0f3e763209348e6b1e34be71716029b8faaa0caf.zip |
Added experimental PHP taint support to ITools
Diffstat (limited to 'it_html.class')
-rw-r--r-- | it_html.class | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/it_html.class b/it_html.class index a73bba6..08904a8 100644 --- a/it_html.class +++ b/it_html.class @@ -220,13 +220,13 @@ function _parse_args($args) foreach ($arg as $key => $value) { if (is_int($key)) - $data .= $value; + $data .= it_taintcheck($value); else $p[$key] = $value; } } else - $data .= $arg; + $data .= it_taintcheck($arg); } return array($data, $p); @@ -265,7 +265,7 @@ function _tag($name, $args) if (($value === null) || ($value === false)) # null or false: omit whole tag ; else if (isset($value) && $value !== true) # normal case: value - $result .= " $key=\"" . (preg_match("/[<>&\"'\n\x80-\x9f]/", $value) ? str_replace("\n", " ", Q($value)) : $value) . '"'; + $result .= " $key=\"" . (preg_match("/[<>&\"'\n\x80-\x9f]/", $value) ? str_replace("\n", " ", Q($value)) : it_untaint($value)) . '"'; else # true: tag without value $result .= ($this->p['htmltype'] == 'html') ? " $key" : " $key=\"$key\""; } @@ -436,7 +436,7 @@ function u(/* ... */) list($base, $params) = it_html::_parse_args($args); if (!isset($base)) - $base = $_SERVER['PHP_SELF']; + it_untaint($base = $_SERVER['PHP_SELF']); $base = preg_replace('|\0|', '', $base); $base = preg_replace('|[^\w.+!*(),:?@&=/~$-]|e', 'urlencode("$0")', $base); |