php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #65944
Patch big-file-uploads revision 2013-10-22 10:18 UTC by jules at ecs dot soton dot ac dot uk

Patch big-file-uploads for Apache2 related Bug #65944

Patch version 2013-10-22 10:18 UTC

Return to Bug #65944 | Download this patch
Patch Revisions:

Developer: jules@ecs.soton.ac.uk

diff -Naur php-5.5.5/Zend/zend_operators.c php-5.5.5-patched/Zend/zend_operators.c
--- php-5.5.5/Zend/zend_operators.c	2013-10-15 14:49:47.000000000 +0100
+++ php-5.5.5-patched/Zend/zend_operators.c	2013-10-22 11:13:24.000000000 +0100
@@ -79,9 +79,9 @@
 		zend_binary_strncasecmp
  */
 
-ZEND_API int zend_atoi(const char *str, int str_len) /* {{{ */
+ZEND_API long zend_atoi(const char *str, int str_len) /* {{{ */
 {
-	int retval;
+	long retval;
 
 	if (!str_len) {
 		str_len = strlen(str);
diff -Naur php-5.5.5/Zend/zend_operators.h php-5.5.5-patched/Zend/zend_operators.h
--- php-5.5.5/Zend/zend_operators.h	2013-10-15 14:49:47.000000000 +0100
+++ php-5.5.5-patched/Zend/zend_operators.h	2013-10-22 11:13:04.000000000 +0100
@@ -372,7 +372,7 @@
 ZEND_API void zend_compare_arrays(zval *result, zval *a1, zval *a2 TSRMLS_DC);
 ZEND_API void zend_compare_objects(zval *result, zval *o1, zval *o2 TSRMLS_DC);
 
-ZEND_API int zend_atoi(const char *str, int str_len);
+ZEND_API long zend_atoi(const char *str, int str_len);
 ZEND_API long zend_atol(const char *str, int str_len);
 
 ZEND_API void zend_locale_sprintf_double(zval *op ZEND_FILE_LINE_DC);
diff -Naur php-5.5.5/main/SAPI.h php-5.5.5-patched/main/SAPI.h
--- php-5.5.5/main/SAPI.h	2013-10-15 14:49:47.000000000 +0100
+++ php-5.5.5-patched/main/SAPI.h	2013-10-22 11:14:05.000000000 +0100
@@ -82,7 +82,7 @@
 	char *post_data, *raw_post_data;
 	char *cookie_data;
 	long content_length;
-	uint post_data_length, raw_post_data_length;
+	uint IGNORE_post_data_length, IGNORE_raw_post_data_length;
 
 	char *path_translated;
 	char *request_uri;
@@ -112,6 +112,7 @@
 	int argc;
 	char **argv;
 	int proto_num;
+	long post_data_length, raw_post_data_length;
 } sapi_request_info;
 
 
@@ -119,7 +120,7 @@
 	void *server_context;
 	sapi_request_info request_info;
 	sapi_headers_struct sapi_headers;
-	int read_post_bytes;
+	long read_post_bytes;
 	unsigned char headers_sent;
 	struct stat global_stat;
 	char *default_mimetype;
diff -Naur php-5.5.5/main/rfc1867.c php-5.5.5-patched/main/rfc1867.c
--- php-5.5.5/main/rfc1867.c	2013-10-15 14:49:47.000000000 +0100
+++ php-5.5.5-patched/main/rfc1867.c	2013-10-22 11:14:24.000000000 +0100
@@ -676,8 +676,8 @@
 {
 	char *boundary, *s = NULL, *boundary_end = NULL, *start_arr = NULL, *array_index = NULL;
 	char *temp_filename = NULL, *lbuf = NULL, *abuf = NULL;
-	int boundary_len = 0, total_bytes = 0, cancel_upload = 0, is_arr_upload = 0, array_len = 0;
-	int max_file_size = 0, skip_upload = 0, anonindex = 0, is_anonymous;
+	long total_bytes=0; int boundary_len=0, cancel_upload = 0, is_arr_upload = 0, array_len = 0;
+	long max_file_size = 0; int  skip_upload = 0, anonindex = 0, is_anonymous;
 	zval *http_post_files = NULL;
 	HashTable *uploaded_files = NULL;
 	multipart_buffer *mbuff;
diff -Naur php-5.5.5/sapi/cgi/cgi_main.c php-5.5.5-patched/sapi/cgi/cgi_main.c
--- php-5.5.5/sapi/cgi/cgi_main.c	2013-10-15 14:49:47.000000000 +0100
+++ php-5.5.5-patched/sapi/cgi/cgi_main.c	2013-10-22 11:13:39.000000000 +0100
@@ -508,7 +508,7 @@
 	uint read_bytes = 0;
 	int tmp_read_bytes;
 
-	count_bytes = MIN(count_bytes, (uint) SG(request_info).content_length - SG(read_post_bytes));
+	count_bytes = MIN(count_bytes,  SG(request_info).content_length - SG(read_post_bytes));
 	while (read_bytes < count_bytes) {
 		tmp_read_bytes = read(STDIN_FILENO, buffer + read_bytes, count_bytes - read_bytes);
 		if (tmp_read_bytes <= 0) {
@@ -525,7 +525,7 @@
 	int tmp_read_bytes;
 	fcgi_request *request = (fcgi_request*) SG(server_context);
 
-	count_bytes = MIN(count_bytes, (uint) SG(request_info).content_length - SG(read_post_bytes));
+	count_bytes = MIN(count_bytes,  SG(request_info).content_length - SG(read_post_bytes));
 	while (read_bytes < count_bytes) {
 		tmp_read_bytes = fcgi_read(request, buffer + read_bytes, count_bytes - read_bytes);
 		if (tmp_read_bytes <= 0) {
diff -Naur php-5.5.5/sapi/fpm/fpm/fpm_main.c php-5.5.5-patched/sapi/fpm/fpm/fpm_main.c
--- php-5.5.5/sapi/fpm/fpm/fpm_main.c	2013-10-15 14:49:47.000000000 +0100
+++ php-5.5.5-patched/sapi/fpm/fpm/fpm_main.c	2013-10-22 11:13:39.000000000 +0100
@@ -499,7 +499,7 @@
 	uint read_bytes = 0;
 	int tmp_read_bytes;
 
-	count_bytes = MIN(count_bytes, (uint) SG(request_info).content_length - SG(read_post_bytes));
+	count_bytes = MIN(count_bytes,  SG(request_info).content_length - SG(read_post_bytes));
 	while (read_bytes < count_bytes) {
 		fcgi_request *request = (fcgi_request*) SG(server_context);
 		if (request_body_fd == -1) {
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 29 07:01:30 2024 UTC