Skip to content

Commit c317c42

Browse files
committed
Merge branch 'PHP-7.4'
* PHP-7.4: 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 7dd332f + 355e36e commit c317c42

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
@@ -604,7 +604,7 @@ static void *php_ap_memstr(char *haystack, int haystacklen, char *needle, int ne
604604
}
605605

606606
/* read until a boundary condition */
607-
static int multipart_buffer_read(multipart_buffer *self, char *buf, size_t bytes, int *end)
607+
static size_t multipart_buffer_read(multipart_buffer *self, char *buf, size_t bytes, int *end)
608608
{
609609
size_t len, max;
610610
char *bound;
@@ -643,7 +643,7 @@ static int multipart_buffer_read(multipart_buffer *self, char *buf, size_t bytes
643643
self->buf_begin += len;
644644
}
645645

646-
return (int)len;
646+
return len;
647647
}
648648

649649
/*
@@ -653,7 +653,7 @@ static int multipart_buffer_read(multipart_buffer *self, char *buf, size_t bytes
653653
static char *multipart_buffer_read_body(multipart_buffer *self, size_t *len)
654654
{
655655
char buf[FILLUNIT], *out=NULL;
656-
int total_bytes=0, read_bytes=0;
656+
size_t total_bytes=0, read_bytes=0;
657657

658658
while((read_bytes = multipart_buffer_read(self, buf, sizeof(buf), NULL))) {
659659
out = erealloc(out, total_bytes + read_bytes + 1);
@@ -680,7 +680,8 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
680680
char *boundary, *s = NULL, *boundary_end = NULL, *start_arr = NULL, *array_index = NULL;
681681
char *lbuf = NULL, *abuf = NULL;
682682
zend_string *temp_filename = NULL;
683-
int boundary_len = 0, cancel_upload = 0, is_arr_upload = 0, array_len = 0;
683+
int boundary_len = 0, cancel_upload = 0, is_arr_upload = 0;
684+
size_t array_len = 0;
684685
int64_t total_bytes = 0, max_file_size = 0;
685686
int skip_upload = 0, anonindex = 0, is_anonymous;
686687
HashTable *uploaded_files = NULL;
@@ -1114,7 +1115,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
11141115
is_arr_upload = (start_arr = strchr(param,'[')) && (param[strlen(param)-1] == ']');
11151116

11161117
if (is_arr_upload) {
1117-
array_len = (int)strlen(start_arr);
1118+
array_len = strlen(start_arr);
11181119
if (array_index) {
11191120
efree(array_index);
11201121
}

0 commit comments

Comments
 (0)