tony2001 Sat Dec 29 10:50:12 2007 UTC Modified files: /php-src/main/streams streams.c Log: apply correct fix for bug #43522 fix Unicode streams too this time http://cvs.php.net/viewvc.cgi/php-src/main/streams/streams.c?r1=1.155&r2=1.156&diff_format=u Index: php-src/main/streams/streams.c diff -u php-src/main/streams/streams.c:1.155 php-src/main/streams/streams.c:1.156 --- php-src/main/streams/streams.c:1.155 Mon Dec 10 14:19:20 2007 +++ php-src/main/streams/streams.c Sat Dec 29 10:50:12 2007 @@ -19,7 +19,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: streams.c,v 1.155 2007/12/10 14:19:20 iliaa Exp $ */ +/* $Id: streams.c,v 1.156 2007/12/29 10:50:12 tony2001 Exp $ */ #define _GNU_SOURCE #include "php.h" @@ -1104,10 +1104,17 @@ if (delim_len == 0 || !delim) { toread = maxlen; } else { + size_t seek_len; + + seek_len = stream->writepos - stream->readpos; + if (seek_len > maxlen) { + seek_len = maxlen; + } + if (delim_len == 1) { - e = memchr(stream->readbuf.s + stream->readpos, *delim, maxlen); + e = memchr(stream->readbuf.s + stream->readpos, *delim, seek_len); } else { - e = php_memnstr(stream->readbuf.s + stream->readpos, delim, delim_len, (stream->readbuf.s + stream->readpos + maxlen)); + e = php_memnstr(stream->readbuf.s + stream->readpos, delim, delim_len, (stream->readbuf.s + stream->readpos + seek_len)); } if (!e) { @@ -1153,10 +1160,17 @@ if (delim_len == 0 || !delim) { toread = maxlen; } else { + size_t seek_len; + + seek_len = stream->writepos - stream->readpos; + if (seek_len > maxlen) { + seek_len = maxlen; + } + if (delim_len == 1) { - e = u_memchr(stream->readbuf.u + stream->readpos, *delim, stream->writepos - stream->readpos); + e = u_memchr(stream->readbuf.u + stream->readpos, *delim, seek_len); } else { - e = u_strFindFirst(stream->readbuf.u + stream->readpos, stream->writepos - stream->readpos, delim, delim_len); + e = u_strFindFirst(stream->readbuf.u + stream->readpos, stream->readbuf.u + stream->readpos + seek_len, delim, delim_len); } if (!e) {
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php