summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2020-03-18 10:57:42 +0100
committerChristoph M. Becker <cmbecker69@gmx.de>2020-05-12 09:01:18 +0200
commit8fd927768991df88df0c338b2b7c29e490392430 (patch)
tree9cf9c3f03502f4e2345405b47808b34f80dcdfd8
parentc71416cba2ad7b596233e3c0da117a90a2e78bbf (diff)
downloadphp-git-php-7.3.18.tar.gz
Fix #78876: Long variables cause OOM and temp files are not cleanedphp-7.3.18PHP-7.3.18
We use the proper type for size calculations, which is `size_t`. (cherry picked from commit 3c8582ca4b8e84e5647220b647914876d2c3b124)
-rw-r--r--NEWS2
-rw-r--r--main/rfc1867.c6
2 files changed, 5 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index 5e7b2287df..b9cc1efcd6 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@ PHP NEWS
- Core:
. Fixed bug #78875 (Long filenames cause OOM and temp files are not cleaned).
(CVE-2019-11048) (cmb)
+ . Fixed bug #78876 (Long variables in multipart/form-data cause OOM and temp
+ files are not cleaned). (CVE-2019-11048) (cmb)
. Fixed bug #79434 (PHP 7.3 and PHP-7.4 crash with NULL-pointer dereference
on !CS constant). (Nikita)
. Fixed bug #79477 (casting object into array creates references). (Nikita)
diff --git a/main/rfc1867.c b/main/rfc1867.c
index 617a94d0ef..3f91fe6fb4 100644
--- a/main/rfc1867.c
+++ b/main/rfc1867.c
@@ -614,7 +614,7 @@ static void *php_ap_memstr(char *haystack, int haystacklen, char *needle, int ne
}
/* read until a boundary condition */
-static int multipart_buffer_read(multipart_buffer *self, char *buf, size_t bytes, int *end)
+static size_t multipart_buffer_read(multipart_buffer *self, char *buf, size_t bytes, int *end)
{
size_t len, max;
char *bound;
@@ -653,7 +653,7 @@ static int multipart_buffer_read(multipart_buffer *self, char *buf, size_t bytes
self->buf_begin += len;
}
- return (int)len;
+ return len;
}
/*
@@ -663,7 +663,7 @@ static int multipart_buffer_read(multipart_buffer *self, char *buf, size_t bytes
static char *multipart_buffer_read_body(multipart_buffer *self, size_t *len)
{
char buf[FILLUNIT], *out=NULL;
- int total_bytes=0, read_bytes=0;
+ size_t total_bytes=0, read_bytes=0;
while((read_bytes = multipart_buffer_read(self, buf, sizeof(buf), NULL))) {
out = erealloc(out, total_bytes + read_bytes + 1);