ID: 21760 Comment by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Open Bug Type: Sockets related Operating System: FreeBSD 4.7 PHP Version: 4.3.0 New Comment:
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++; Previous Comments: ------------------------------------------------------------------------ [2003-01-19 23:18:44] [EMAIL PROTECTED] $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. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=21760&edit=1