Created
March 18, 2020 09:58
-
-
Save cmb69/94d3993ad9e2ee5d2ddabff18f6a86b8 to your computer and use it in GitHub Desktop.
PHP bug #78876
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From f6545c462d4dc23dc749f9b6b08f0503c2356a0a Mon Sep 17 00:00:00 2001 | |
From: "Christoph M. Becker" <cmbecker69@gmx.de> | |
Date: Wed, 18 Mar 2020 10:57:42 +0100 | |
Subject: [PATCH] Fix #78876: Long variables cause OOM and temp files are not | |
cleaned | |
We use the proper type for size calculations, which is `size_t`. | |
--- | |
main/rfc1867.c | 6 +++--- | |
1 file changed, 3 insertions(+), 3 deletions(-) | |
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); | |
-- | |
2.25.1.windows.1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment