diff -u -r old/main/rfc1867.c php5-5.2.10.dfsg.1/main/rfc1867.c
--- old/main/rfc1867.c	2009-12-09 08:20:52.000000000 +0000
+++ php5-5.2.10.dfsg.1/main/rfc1867.c	2009-12-09 08:23:25.000000000 +0000
@@ -765,7 +765,7 @@
 {
 	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;
+	long total_bytes = 0; int boundary_len = 0, cancel_upload = 0, is_arr_upload = 0, array_len = 0;
 	int max_file_size = 0, skip_upload = 0, anonindex = 0, is_anonymous;
 	zval *http_post_files = NULL;
	HashTable *uploaded_files = NULL;
diff -u -r old/main/SAPI.h php5-5.2.10.dfsg.1/main/SAPI.h
--- old/main/SAPI.h	2008-12-31 11:17:47.000000000 +0000
+++ php5-5.2.10.dfsg.1/main/SAPI.h	2009-12-09 08:23:25.000000000 +0000
@@ -80,7 +80,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;
@@ -111,6 +111,7 @@
 	int argc;
 	char **argv;
 	int proto_num;
+	long post_data_length, raw_post_data_length;
 } sapi_request_info;
 
 
@@ -118,7 +119,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 -u -r old/sapi/apache/mod_php5.c php5-5.2.10.dfsg.1/sapi/apache/mod_php5.c
--- old/sapi/apache/mod_php5.c	2009-12-09 08:20:51.000000000 +0000
+++ php5-5.2.10.dfsg.1/sapi/apache/mod_php5.c	2009-12-09 08:23:25.000000000 +0000
@@ -511,7 +511,7 @@
 	SG(request_info).request_uri = r->uri;
 	SG(request_info).request_method = (char *)r->method;
 	SG(request_info).content_type = (char *) table_get(r->subprocess_env, "CONTENT_TYPE");
-	SG(request_info).content_length = (content_length ? atoi(content_length) : 0);
+	SG(request_info).content_length = (content_length ? atol(content_length) : 0);
 	SG(sapi_headers).http_response_code = r->status;
 	SG(request_info).proto_num = r->proto_num;
 
diff -u -r old/sapi/apache2filter/sapi_apache2.c php5-5.2.10.dfsg.1/sapi/apache2filter/sapi_apache2.c
--- old/sapi/apache2filter/sapi_apache2.c	2009-12-09 08:20:51.000000000 +0000
+++ php5-5.2.10.dfsg.1/sapi/apache2filter/sapi_apache2.c	2009-12-09 08:23:25.000000000 +0000
@@ -402,7 +402,7 @@
 	efree(content_type);
 
 	content_length = (char *) apr_table_get(f->r->headers_in, "Content-Length");
-	SG(request_info).content_length = (content_length ? atoi(content_length) : 0);
+	SG(request_info).content_length = (content_length ? atol(content_length) : 0);
 	
 	apr_table_unset(f->r->headers_out, "Content-Length");
 	apr_table_unset(f->r->headers_out, "Last-Modified");
diff -u -r old/sapi/apache2handler/sapi_apache2.c php5-5.2.10.dfsg.1/sapi/apache2handler/sapi_apache2.c
--- old/sapi/apache2handler/sapi_apache2.c	2009-12-09 08:20:51.000000000 +0000
+++ php5-5.2.10.dfsg.1/sapi/apache2handler/sapi_apache2.c	2009-12-09 08:23:25.000000000 +0000
@@ -464,7 +464,7 @@
 	r->no_local_copy = 1;
 
 	content_length = (char *) apr_table_get(r->headers_in, "Content-Length");
-	SG(request_info).content_length = (content_length ? atoi(content_length) : 0);
+	SG(request_info).content_length = (content_length ? atol(content_length) : 0);
 
 	apr_table_unset(r->headers_out, "Content-Length");
 	apr_table_unset(r->headers_out, "Last-Modified");
diff -u -r old/sapi/apache_hooks/mod_php5.c php5-5.2.10.dfsg.1/sapi/apache_hooks/mod_php5.c
--- old/sapi/apache_hooks/mod_php5.c	2008-12-31 11:17:48.000000000 +0000
+++ php5-5.2.10.dfsg.1/sapi/apache_hooks/mod_php5.c	2009-12-09 08:23:25.000000000 +0000
@@ -571,7 +571,7 @@
 	SG(request_info).request_method = (char *)r->method;
 	SG(request_info).proto_num = r->proto_num;
 	SG(request_info).content_type = (char *) table_get(r->subprocess_env, "CONTENT_TYPE");
-	SG(request_info).content_length = (content_length ? atoi(content_length) : 0);
+	SG(request_info).content_length = (content_length ? atol(content_length) : 0);
 	SG(sapi_headers).http_response_code = r->status;
 
 	if (r->headers_in) {
diff -u -r old/sapi/cgi/cgi_main.c php5-5.2.10.dfsg.1/sapi/cgi/cgi_main.c
--- old/sapi/cgi/cgi_main.c	2009-12-09 08:20:51.000000000 +0000
+++ php5-5.2.10.dfsg.1/sapi/cgi/cgi_main.c	2009-12-09 08:23:25.000000000 +0000
@@ -469,7 +469,7 @@
 {
 	int read_bytes=0, 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) {
 #if PHP_FASTCGI
 		if (fcgi_is_fastcgi()) {
@@ -1188,7 +1188,7 @@
 		/* FIXME - Work out proto_num here */
 		SG(request_info).query_string = sapi_cgibin_getenv("QUERY_STRING", sizeof("QUERY_STRING")-1 TSRMLS_CC);
 		SG(request_info).content_type = (content_type ? content_type : "" );
-		SG(request_info).content_length = (content_length ? atoi(content_length) : 0);
+		SG(request_info).content_length = (content_length ? atol(content_length) : 0);
 		
 		/* The CGI RFC allows servers to pass on unvalidated Authorization data */
 		auth = sapi_cgibin_getenv("HTTP_AUTHORIZATION", sizeof("HTTP_AUTHORIZATION")-1 TSRMLS_CC);
diff -ur php-5.2.14.orig/ext/suhosin/rfc1867.c php-5.2.14/ext/suhosin/rfc1867.c
--- php-5.2.14.orig/ext/suhosin/rfc1867.c	2011-08-22 12:48:55.933908000 +0200
+++ php-5.2.14/ext/suhosin/rfc1867.c	2011-08-22 12:49:55.702561000 +0200
@@ -771,7 +771,7 @@
 {
 	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;
+	long total_bytes=0; int boundary_len=0, cancel_upload=0, is_arr_upload=0, array_len=0;
 	int max_file_size=0, skip_upload=0, anonindex=0, is_anonymous;
 	zval *http_post_files=NULL; HashTable *uploaded_files=NULL;
 #if HAVE_MBSTRING && !defined(COMPILE_DL_MBSTRING)
