Skip to content

Commit 8fd9277

Browse files
committed
Fix #78876: Long variables cause OOM and temp files are not cleaned
We use the proper type for size calculations, which is `size_t`. (cherry picked from commit 3c8582c)
1 parent c71416c commit 8fd9277

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ PHP NEWS
55
- Core:
66
. Fixed bug #78875 (Long filenames cause OOM and temp files are not cleaned).
77
(CVE-2019-11048) (cmb)
8+
. Fixed bug #78876 (Long variables in multipart/form-data cause OOM and temp
9+
files are not cleaned). (CVE-2019-11048) (cmb)
810
. Fixed bug #79434 (PHP 7.3 and PHP-7.4 crash with NULL-pointer dereference
911
on !CS constant). (Nikita)
1012
. Fixed bug #79477 (casting object into array creates references). (Nikita)

main/rfc1867.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ static void *php_ap_memstr(char *haystack, int haystacklen, char *needle, int ne
614614
}
615615

616616
/* read until a boundary condition */
617-
static int multipart_buffer_read(multipart_buffer *self, char *buf, size_t bytes, int *end)
617+
static size_t multipart_buffer_read(multipart_buffer *self, char *buf, size_t bytes, int *end)
618618
{
619619
size_t len, max;
620620
char *bound;
@@ -653,7 +653,7 @@ static int multipart_buffer_read(multipart_buffer *self, char *buf, size_t bytes
653653
self->buf_begin += len;
654654
}
655655

656-
return (int)len;
656+
return len;
657657
}
658658

659659
/*
@@ -663,7 +663,7 @@ static int multipart_buffer_read(multipart_buffer *self, char *buf, size_t bytes
663663
static char *multipart_buffer_read_body(multipart_buffer *self, size_t *len)
664664
{
665665
char buf[FILLUNIT], *out=NULL;
666-
int total_bytes=0, read_bytes=0;
666+
size_t total_bytes=0, read_bytes=0;
667667

668668
while((read_bytes = multipart_buffer_read(self, buf, sizeof(buf), NULL))) {
669669
out = erealloc(out, total_bytes + read_bytes + 1);

0 commit comments

Comments
 (0)