|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-01-19 23:18 UTC] sunday at csh dot rit dot edu
$string = socket_read( $socket, 100, PHP_NORMAL_READ ); will return a "\n" after several reads, and continue to return "\n" in an infinite loop rather than the rest of the buffer. The server it's reading from sends a large multi-line (lines terminated with "\n") packet (~7500 bytes) in one write() call. After reading through about half of it with the line above, socket_read will start returning bad data about 10% - 20% of the time. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 11:00:02 2025 UTC |
I believe this is caused by a comparison to an uninitialized buffer in php_read (buffer emalloc'd in socket_read). Patch: --- php5/ext/sockets/sockets.c 2003-01-18 19:28:06.000000000 +0000 +++ php5-atropine/ext/sockets/sockets.c 2003-02-05 15:43:00.000000000 +0000 @@ -288,6 +288,7 @@ set_errno(0); + *t = 0; while (*t != '\n' && *t != '\r' && n < maxlen) { if (m > 0) { t++;