Changeset c29b82d in github
- Timestamp:
- Dec 20, 2011 3:29:28 AM (17 months ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.8
- Children:
- bab0433
- Parents:
- 1886349
- Location:
- program
- Files:
-
- 1 added
- 1 edited
-
include/rcube_content_filter.php (added)
-
steps/mail/get.inc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
program/steps/mail/get.inc
rb6da0b7 rc29b82d 6 6 | | 7 7 | This file is part of the Roundcube Webmail client | 8 | Copyright (C) 2005-20 09, The Roundcube Dev Team |8 | Copyright (C) 2005-2011, The Roundcube Dev Team | 9 9 | Licensed under the GNU GPL | 10 10 | | … … 195 195 196 196 197 198 /**199 * PHP stream filter to detect html/javascript code in attachments200 */201 class rcube_content_filter extends php_user_filter202 {203 private $buffer = '';204 private $cutoff = 2048;205 206 function onCreate()207 {208 $this->cutoff = rand(2048, 3027);209 return true;210 }211 212 function filter($in, $out, &$consumed, $closing)213 {214 while ($bucket = stream_bucket_make_writeable($in)) {215 $this->buffer .= $bucket->data;216 217 // check for evil content and abort218 if (preg_match('/<(script|iframe|object)/i', $this->buffer))219 return PSFS_ERR_FATAL;220 221 // keep buffer small enough222 if (strlen($this->buffer) > 4096)223 $this->buffer = substr($this->buffer, $this->cutoff);224 225 $consumed += $bucket->datalen;226 stream_bucket_append($out, $bucket);227 }228 229 return PSFS_PASS_ON;230 }231 }232
Note: See TracChangeset
for help on using the changeset viewer.
