summaryrefslogtreecommitdiff
path: root/sapi
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2013-10-28 13:46:40 +0400
committerAntony Dovgal <tony2001@php.net>2013-10-28 13:46:40 +0400
commit09ad5fbbb35f9b3180c853cb05cbb2b3ac6a298a (patch)
tree41e3073fcacf21cb40ad556af8ba81a8d6020d8d /sapi
parent73788d1c2327048a34165b07873864f0c30d5dc0 (diff)
parent4bdac868daf8abd1e4c4f814455b0b0b323da530 (diff)
downloadphp-git-09ad5fbbb35f9b3180c853cb05cbb2b3ac6a298a.tar.gz
Merge branch 'master' of https://git.php.net/repository/php-src
* 'master' of https://git.php.net/repository/php-src: Improved performance of func_get_args() by eliminating useless copying fix limitation of upload size == (U)INT_MAX in CGI Link to more readmes test commit Update NEWS Fixed bug #65950 Field name truncation if the field name is bigger than 32 characters
Diffstat (limited to 'sapi')
-rw-r--r--sapi/cgi/cgi_main.c5
-rw-r--r--sapi/fpm/fpm/fpm_main.c5
2 files changed, 8 insertions, 2 deletions
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index 221b002175..43816d4d13 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -524,8 +524,11 @@ static int sapi_fcgi_read_post(char *buffer, uint count_bytes TSRMLS_DC)
uint read_bytes = 0;
int tmp_read_bytes;
fcgi_request *request = (fcgi_request*) SG(server_context);
+ size_t remaining = SG(request_info).content_length - SG(read_post_bytes);
- count_bytes = MIN(count_bytes, (uint) SG(request_info).content_length - SG(read_post_bytes));
+ if (remaining < count_bytes) {
+ count_bytes = remaining;
+ }
while (read_bytes < count_bytes) {
tmp_read_bytes = fcgi_read(request, buffer + read_bytes, count_bytes - read_bytes);
if (tmp_read_bytes <= 0) {
diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c
index 4b20e632dd..91abfea959 100644
--- a/sapi/fpm/fpm/fpm_main.c
+++ b/sapi/fpm/fpm/fpm_main.c
@@ -498,8 +498,11 @@ static int sapi_cgi_read_post(char *buffer, uint count_bytes TSRMLS_DC)
{
uint read_bytes = 0;
int tmp_read_bytes;
+ size_t remaining = SG(request_info).content_length - SG(read_post_bytes);
- count_bytes = MIN(count_bytes, (uint) SG(request_info).content_length - SG(read_post_bytes));
+ if (remaining < count_bytes) {
+ count_bytes = remaining;
+ }
while (read_bytes < count_bytes) {
fcgi_request *request = (fcgi_request*) SG(server_context);
if (request_body_fd == -1) {