note 82711 added to function.stream-socket-server
| From: | jasonrlester at yahoo dot com | Date: | Wed, 23 Apr 2008 05:34:05 +0000 |
| Subject: | note 82711 added to function.stream-socket-server | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-138677@lists.php.net to get a copy of this message | ||
I found a problem while using fread on stream servers that could lead to issues. The problem (as of
5.2.5 on Windows XP and Debian) is that the memory allocated to fread()'s internal buffer
doesn't seem to ever be deallocated while the server is running. For example, if you start your
server and send it 1 char, the current memory of the script will increase by 8 bits. If you send it
1 char again the current memory will stay the same. If you send it 4,5,6 or 7 it will stay the same,
but on 8 it will increase. current memory will then stay the same though 9 - 15, but increase on 16
and this cycle will contenue for every 8 chars that you increase. Long story short, if you fread 10
megs of data the area allocated to the buffer will be increased to hold the 10 megs and then remain
that size until the server is restarted, even if all following freads are less then 1 kb. If
exploited this be used to run a server into the ground.
----
Server IP: 208.69.120.35
Probable Submitter: 66.235.31.35
----
Manual Page -- http://www.php.net/manual/en/function.stream-socket-server.php
Edit -- https://master.php.net/note/edit/82711
Del: integrated -- https://master.php.net/note/delete/82711/integrated
Del: useless -- https://master.php.net/note/delete/82711/useless
Del: bad code -- https://master.php.net/note/delete/82711/bad+code
Del: spam -- https://master.php.net/note/delete/82711/spam
Del: non-english -- https://master.php.net/note/delete/82711/non-english
Del: in docs -- https://master.php.net/note/delete/82711/in+docs
Del: other reasons-- https://master.php.net/note/delete/82711
Reject -- https://master.php.net/note/reject/82711
Search -- https://master.php.net/manage/user-notes.php