Skip to content

Commit f430412

Browse files
committed
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2: Fix #78876: Long variables cause OOM and temp files are not cleaned Fix #78875: Long filenames cause OOM and temp files are not cleaned Update NEWS for 7.2.31 Update CREDITS for PHP 7.2.30 Update NEWS for PHP 7.2.30
2 parents 5174318 + 3c8582c commit f430412

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

main/rfc1867.c

Lines changed: 6 additions & 5 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);
@@ -690,7 +690,8 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
690690
char *boundary, *s = NULL, *boundary_end = NULL, *start_arr = NULL, *array_index = NULL;
691691
char *lbuf = NULL, *abuf = NULL;
692692
zend_string *temp_filename = NULL;
693-
int boundary_len = 0, cancel_upload = 0, is_arr_upload = 0, array_len = 0;
693+
int boundary_len = 0, cancel_upload = 0, is_arr_upload = 0;
694+
size_t array_len = 0;
694695
int64_t total_bytes = 0, max_file_size = 0;
695696
int skip_upload = 0, anonindex = 0, is_anonymous;
696697
HashTable *uploaded_files = NULL;
@@ -1124,7 +1125,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
11241125
is_arr_upload = (start_arr = strchr(param,'[')) && (param[strlen(param)-1] == ']');
11251126

11261127
if (is_arr_upload) {
1127-
array_len = (int)strlen(start_arr);
1128+
array_len = strlen(start_arr);
11281129
if (array_index) {
11291130
efree(array_index);
11301131
}

0 commit comments

Comments
 (0)