summaryrefslogtreecommitdiffstats
path: root/newlib/libc
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc')
-rw-r--r--newlib/libc/stdio/open_memstream.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/newlib/libc/stdio/open_memstream.c b/newlib/libc/stdio/open_memstream.c
index 2066822cd..a53bdef2f 100644
--- a/newlib/libc/stdio/open_memstream.c
+++ b/newlib/libc/stdio/open_memstream.c
@@ -330,8 +330,10 @@ _DEFUN(internal_open_memstream_r, (ptr, buf, size, wide),
c->max *= sizeof(wchar_t);
if (c->max < 64)
c->max = 64;
+#if (SIZE_MAX >= 64 * 1024)
else if (c->max > 64 * 1024)
c->max = 64 * 1024;
+#endif
*size = 0;
*buf = _malloc_r (ptr, c->max);
if (!*buf)