pgpool2.git / summary / log / commit / refs

commit    8a4a102c70b70fe7da557a0a536334e32f8c7f87
Author:   Tatsuo Ishii <ishii@postgresql.org>
Date:     Fri Nov 22 12:43:43 2013 +0000

    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".


src/utils/pool_process_reporting.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/pool_process_reporting.c b/src/utils/pool_process_reporting.c index 35a1d5b09..b81334a35 100644 --- a/src/utils/pool_process_reporting.c +++ b/src/utils/pool_process_reporting.c @@ -1231,11 +1231,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); [parent: 11b7a02e0a23]