summaryrefslogtreecommitdiff
path: root/main/streams/streams.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2004-10-11 18:31:49 +0000
committerIlia Alshanetsky <iliaa@php.net>2004-10-11 18:31:49 +0000
commit5c04e39383fcf889c5b7824299d0232e5477a9b3 (patch)
tree95d04bbe431da866b6c76fe03e454765f923286b /main/streams/streams.c
parentf8a4d8a4d5f379cfedb57aa4ed41a8c682585cc5 (diff)
downloadphp-git-5c04e39383fcf889c5b7824299d0232e5477a9b3.tar.gz
Fixed bug #30362 (stream_get_line() not handling end string correctly).
Diffstat (limited to 'main/streams/streams.c')
-rwxr-xr-xmain/streams/streams.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/main/streams/streams.c b/main/streams/streams.c
index 6242afcf82..9a071746bc 100755
--- a/main/streams/streams.c
+++ b/main/streams/streams.c
@@ -846,7 +846,7 @@ PHPAPI char *php_stream_get_record(php_stream *stream, size_t maxlen, size_t *re
php_stream_fill_read_buffer(stream, maxlen TSRMLS_CC);
- if (delim_len == 0) {
+ if (delim_len == 0 || !delim) {
toread = maxlen;
} else {
if (delim_len == 1) {
@@ -870,6 +870,7 @@ PHPAPI char *php_stream_get_record(php_stream *stream, size_t maxlen, size_t *re
*returned_len = php_stream_read(stream, buf, toread);
if (*returned_len >= 0) {
+ buf[*returned_len] = '\0';
return buf;
} else {
efree(buf);