Make WordPress Core

Changeset 3798


Ignore:
Timestamp:
05/26/2006 09:14:36 PM (20 years ago)
Author:
ryan
Message:

base64 cached objects and store within multi-line comment block to avoid CRLF injections into the cache. Props Peter Westwood.

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/cache.php

    r3576 r3798  
    4848}
    4949
    50 define('CACHE_SERIAL_HEADER', "<?php\n//");
    51 define('CACHE_SERIAL_FOOTER', "\n?".">");
     50define('CACHE_SERIAL_HEADER', "<?php\n/*");
     51define('CACHE_SERIAL_FOOTER', "*/\n?".">");
    5252
    5353class WP_Object_Cache {
     
    159159        }
    160160
    161         $this->cache[$group][$id] = unserialize(substr(@ file_get_contents($cache_file), strlen(CACHE_SERIAL_HEADER), -strlen(CACHE_SERIAL_FOOTER)));
     161        $this->cache[$group][$id] = unserialize(base64_decode(substr(@ file_get_contents($cache_file), strlen(CACHE_SERIAL_HEADER), -strlen(CACHE_SERIAL_FOOTER))));
    162162        if (false === $this->cache[$group][$id])
    163163            $this->cache[$group][$id] = '';
     
    333333
    334334                $temp_file = tempnam($group_dir, 'tmp');
    335                 $serial = CACHE_SERIAL_HEADER.serialize($this->cache[$group][$id]).CACHE_SERIAL_FOOTER;
     335                $serial = CACHE_SERIAL_HEADER.base64_encode(serialize($this->cache[$group][$id])).CACHE_SERIAL_FOOTER;
    336336                $fd = @fopen($temp_file, 'w');
    337337                if ( false === $fd ) {
  • trunk/wp-includes/version.php

    r3772 r3798  
    44
    55$wp_version = '2.1-alpha1';
    6 $wp_db_version = 3767;
     6$wp_db_version = 3797;
    77
    88?>
Note: See TracChangeset for help on using the changeset viewer.