Make WordPress Core


Ignore:
Timestamp:
12/22/2015 03:22:05 AM (9 years ago)
Author:
dd32
Message:

Update random_compat to latest
Changes:

  • Checks disable_classes for COM() before using to avoid PHP Warnings
  • Uses stream_set_chunk_size() to avoid reading 8KiB from /dev/urandom unintentionally.

Merges [35922] to the 4.4 branch.

Fixes #34948.

Location:
branches/4.4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.4

  • branches/4.4/src/wp-includes/random_compat/random_bytes_dev_urandom.php

    r35600 r36058  
    6363            }
    6464        }
    65         /**
    66          * stream_set_read_buffer() does not exist in HHVM
    67          *
    68          * If we don't set the stream's read buffer to 0, PHP will
    69          * internally buffer 8192 bytes, which can waste entropy
    70          *
    71          * stream_set_read_buffer returns 0 on success
    72          */
    73         if (!empty($fp) && function_exists('stream_set_read_buffer')) {
    74             stream_set_read_buffer($fp, RANDOM_COMPAT_READ_BUFFER);
     65        if (!empty($fp)) {
     66            /**
     67             * stream_set_read_buffer() does not exist in HHVM
     68             *
     69             * If we don't set the stream's read buffer to 0, PHP will
     70             * internally buffer 8192 bytes, which can waste entropy
     71             *
     72             * stream_set_read_buffer returns 0 on success
     73             */
     74            if (function_exists('stream_set_read_buffer')) {
     75                stream_set_read_buffer($fp, RANDOM_COMPAT_READ_BUFFER);
     76            }
     77            if (function_exists('stream_set_chunk_size')) {
     78                stream_set_chunk_size($fp, RANDOM_COMPAT_READ_BUFFER);
     79            }
    7580        }
    7681    }
Note: See TracChangeset for help on using the changeset viewer.