summaryrefslogtreecommitdiffstats
path: root/php-bug78875.patch
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2020-05-12 08:49:43 +0200
committerRemi Collet <remi@remirepo.net>2020-05-12 08:49:43 +0200
commit9eaf588d871806c7b15be482b5740bea85285b93 (patch)
treee51332ce1305a7af03382c7702e5009b3129ef18 /php-bug78875.patch
parent37eeab3864b96768419ed0ee5492bca293ad003c (diff)
Core:
Fix #78875 Long filenames cause OOM and temp files are not cleaned CVE-2019-11048 Fix #78876 Long variables in multipart/form-data cause OOM and temp files are not cleaned
Diffstat (limited to 'php-bug78875.patch')
-rw-r--r--php-bug78875.patch38
1 files changed, 38 insertions, 0 deletions
diff --git a/php-bug78875.patch b/php-bug78875.patch
new file mode 100644
index 0000000..aa04cee
--- /dev/null
+++ b/php-bug78875.patch
@@ -0,0 +1,38 @@
+From d856f7b27eef0249abc6fd2f87cca379b48b815e Mon Sep 17 00:00:00 2001
+From: "Christoph M. Becker" <cmbecker69@gmx.de>
+Date: Wed, 18 Mar 2020 10:26:53 +0100
+Subject: [PATCH] Fix #78875: Long filenames cause OOM and temp files are not
+ cleaned
+
+We must not cast `size_t` to `int` (unless the `size_t` value is
+guaranteed to be less than or equal to `INT_MAX`). In this case we can
+declare `array_len` as `size_t` in the first place.
+
+(cherry picked from commit 1c9bd513ac5c7c1d13d7f0dfa7c16a7ad2ce0f87)
+---
+ main/rfc1867.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/main/rfc1867.c b/main/rfc1867.c
+index b930e07ad1..14ffbea9f4 100644
+--- a/main/rfc1867.c
++++ b/main/rfc1867.c
+@@ -692,7 +692,8 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
+ char *boundary, *s = NULL, *boundary_end = NULL, *start_arr = NULL, *array_index = NULL;
+ char *lbuf = NULL, *abuf = NULL;
+ zend_string *temp_filename = NULL;
+- int boundary_len = 0, cancel_upload = 0, is_arr_upload = 0, array_len = 0;
++ int boundary_len = 0, cancel_upload = 0, is_arr_upload = 0;
++ size_t array_len = 0;
+ int64_t total_bytes = 0, max_file_size = 0;
+ int skip_upload = 0, anonindex = 0, is_anonymous;
+ HashTable *uploaded_files = NULL;
+@@ -1126,7 +1127,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
+ is_arr_upload = (start_arr = strchr(param,'[')) && (param[strlen(param)-1] == ']');
+
+ if (is_arr_upload) {
+- array_len = (int)strlen(start_arr);
++ array_len = strlen(start_arr);
+ if (array_index) {
+ efree(array_index);
+ }