Skip to content

Commit 3c8582c

Browse files
cmb69smalyshev
authored andcommitted
Fix #78876: Long variables cause OOM and temp files are not cleaned
We use the proper type for size calculations, which is `size_t`.
1 parent 1c9bd51 commit 3c8582c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

main/rfc1867.c

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

618618
/* read until a boundary condition */
619-
static int multipart_buffer_read(multipart_buffer *self, char *buf, size_t bytes, int *end)
619+
static size_t multipart_buffer_read(multipart_buffer *self, char *buf, size_t bytes, int *end)
620620
{
621621
size_t len, max;
622622
char *bound;
@@ -655,7 +655,7 @@ static int multipart_buffer_read(multipart_buffer *self, char *buf, size_t bytes
655655
self->buf_begin += len;
656656
}
657657

658-
return (int)len;
658+
return len;
659659
}
660660

661661
/*
@@ -665,7 +665,7 @@ static int multipart_buffer_read(multipart_buffer *self, char *buf, size_t bytes
665665
static char *multipart_buffer_read_body(multipart_buffer *self, size_t *len)
666666
{
667667
char buf[FILLUNIT], *out=NULL;
668-
int total_bytes=0, read_bytes=0;
668+
size_t total_bytes=0, read_bytes=0;
669669

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

0 commit comments

Comments
 (0)