]> granicus.if.org Git - php/commitdiff
Prevent php_stream_get_record from grabbing more than maxlen characters
authorSara Golemon <pollita@php.net>
Fri, 4 Apr 2003 01:34:00 +0000 (01:34 +0000)
committerSara Golemon <pollita@php.net>
Fri, 4 Apr 2003 01:34:00 +0000 (01:34 +0000)
main/streams/streams.c

index e473dad154d25160ba1c792798f49e3b1dce8fc8..d74cccf1ea7f1a1aa5d788481792f56e4957fc89 100755 (executable)
@@ -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);