summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2020-03-18 10:57:42 +0100
committerStanislav Malyshev <stas@php.net>2020-05-11 13:48:40 -0700
commit3c8582ca4b8e84e5647220b647914876d2c3b124 (patch)
treeff4b42efea8bbfea3c47e1e50a7969ddaaf78c4b
parent1c9bd513ac5c7c1d13d7f0dfa7c16a7ad2ce0f87 (diff)
downloadphp-git-3c8582ca4b8e84e5647220b647914876d2c3b124.tar.gz
Fix #78876: Long variables cause OOM and temp files are not cleaned
We use the proper type for size calculations, which is `size_t`.
-rw-r--r--main/rfc1867.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/main/rfc1867.c b/main/rfc1867.c
index 783eab4175..27718e72a4 100644
--- a/main/rfc1867.c
+++ b/main/rfc1867.c
@@ -616,7 +616,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;
@@ -655,7 +655,7 @@ static int multipart_buffer_read(multipart_buffer *self, char *buf, size_t bytes
self->buf_begin += len;
}
- return (int)len;
+ return len;
}
/*
@@ -665,7 +665,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);