From 230557a3ea54ef0de48643379b3cdf7bba02705d Mon Sep 17 00:00:00 2001 From: Tatsuo Ishii Date: Thu, 16 Aug 2018 15:38:33 +0900 Subject: [PATCH] Fix too small buffer size in some configuration file process. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This was found by newer version of gcc warnings. pool_config_variables.c: In function ‘BackendFlagsShowFunc’: pool_config_variables.c:3809:57: warning: ‘__builtin_snprintf’ output truncated before the last format character [-Wformat-truncation=] snprintf(buffer, sizeof(buffer), "DISALLOW_TO_FAILOVER"); ^ In file included from /usr/include/stdio.h:862:0, from pool_config_variables.c:1: /usr/include/x86_64-linux-gnu/bits/stdio2.h:64:10: note: ‘__builtin_snprintf’ output 21 bytes into a destination of size 20 return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __bos (__s), __fmt, __va_arg_pack ()); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- src/config/pool_config_variables.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config/pool_config_variables.c b/src/config/pool_config_variables.c index 638093e39..8778d7b0c 100644 --- a/src/config/pool_config_variables.c +++ b/src/config/pool_config_variables.c @@ -3800,7 +3800,7 @@ static const char* BackendDataDirShowFunc(int index) static const char* BackendFlagsShowFunc(int index) { - static char buffer[20]; + static char buffer[21]; unsigned short flag = g_pool_config.backend_desc->backend_info[index].flag; if (POOL_ALLOW_TO_FAILOVER(flag)) -- 2.39.5