summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSara Golemon <pollita@php.net>2003-04-04 01:34:00 +0000
committerSara Golemon <pollita@php.net>2003-04-04 01:34:00 +0000
commitc985b780a56f8b3fff96f35288aca3e90f8c309c (patch)
treef1c74ae11efe947d58e19d8067e72c1133417c21
parent5ec34bcd82f5753d130ee87985c780e31ba1577f (diff)
downloadphp-git-c985b780a56f8b3fff96f35288aca3e90f8c309c.tar.gz
Prevent php_stream_get_record from grabbing more than maxlen characters
-rwxr-xr-xmain/streams/streams.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/main/streams/streams.c b/main/streams/streams.c
index e473dad154..d74cccf1ea 100755
--- a/main/streams/streams.c
+++ b/main/streams/streams.c
@@ -803,6 +803,10 @@ PHPAPI char *php_stream_get_record(php_stream *stream, size_t maxlen, size_t *re
}
}
+ if (toread > maxlen && maxlen > 0) {
+ toread = maxlen;
+ }
+
buf = emalloc(toread + 1);
*returned_len = php_stream_read(stream, buf, toread);