From 3af576dfe5ff0d685e11d4fe9ecba0c507ca0a92 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Wed, 21 Sep 2022 19:27:10 +0300 Subject: [PATCH 38/38] Increase size of the buffer of fc_vsnprintf() fallback implementation The old internal buffer was 8k. Preparing secfile for saving may request handling of buffers of 8096k. See osdn #45682 Signed-off-by: Marko Lindqvist --- utility/ioz.c | 3 ++- utility/support.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/utility/ioz.c b/utility/ioz.c index 25e3a78c0f..998a68ce82 100644 --- a/utility/ioz.c +++ b/utility/ioz.c @@ -64,7 +64,8 @@ #include "ioz.h" - +/* If you increase size of this, be sure to increase also + * VSNP_BUF_SIZE in support.c so that this still fits in. */ #define PLAIN_FILE_BUF_SIZE (8096*1024) // 8096kb #ifdef FREECIV_HAVE_LIBBZ2 diff --git a/utility/support.c b/utility/support.c index c0a788f07c..af66f1bb47 100644 --- a/utility/support.c +++ b/utility/support.c @@ -872,8 +872,8 @@ size_t fc_strlcat(char *dest, const char *src, size_t n) See also fc_utf8_vsnprintf_trunc(), fc_utf8_vsnprintf_rep(). ****************************************************************************/ -/* "64k should be big enough for anyone" ;-) */ -#define VSNP_BUF_SIZE (64*1024) +/* This must be at least as big as PLAIN_FILE_BUF_SIZE in ioz.c */ +#define VSNP_BUF_SIZE (8096*1024) int fc_vsnprintf(char *str, size_t n, const char *format, va_list ap) { #ifdef HAVE_WORKING_VSNPRINTF -- 2.35.1