note 82711 rejected from function.stream-socket-server by nlopess

From: Date: Sat, 26 Apr 2008 17:42:43 +0000
Subject: note 82711 rejected from function.stream-socket-server by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-138812@lists.php.net to get a copy of this message
Note Submitter: jasonrlester at yahoo dot com ---- 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.

« previous php.notes (#138812) next »