From: Tatsuo Ishii Date: Fri, 22 Nov 2013 13:04:02 +0000 (+0900) Subject: Fix strftime() usage in pool_pools(). X-Git-Tag: V3_1_10~3 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=a12943257fc9894d969f24162f32954fe6f2a02e;p=pgpool2.git Fix strftime() usage in pool_pools(). The buffer is not large enough as expected by the second parameter. This is not harmless because the format string will not produce longer result string than the buffer. Per Coverity report 1111426 "Out-of-bounds access". --- diff --git a/pool_process_reporting.c b/pool_process_reporting.c index b5c148af5..fb5c680a2 100644 --- a/pool_process_reporting.c +++ b/pool_process_reporting.c @@ -878,11 +878,11 @@ void pools_reporting(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend) snprintf(proc_pid, sizeof(proc_pid), "%d", pools[i].pool_pid); snprintf(pool_id, sizeof(pool_id), "%d", pools[i].pool_id); if (pools[i].start_time) - strftime(proc_start_time, POOLCONFIG_MAXDATELEN, "%Y-%m-%d %H:%M:%S", localtime(&pools[i].start_time)); + strftime(proc_start_time, sizeof(proc_start_time), "%Y-%m-%d %H:%M:%S", localtime(&pools[i].start_time)); else *proc_start_time = '\0'; if (pools[i].create_time) - strftime(proc_create_time, POOLCONFIG_MAXDATELEN, "%Y-%m-%d %H:%M:%S", localtime(&pools[i].create_time)); + strftime(proc_create_time, sizeof(proc_create_time), "%Y-%m-%d %H:%M:%S", localtime(&pools[i].create_time)); else *proc_create_time = '\0'; snprintf(majorversion, sizeof(majorversion), "%d", pools[i].pool_majorversion);