pgpool2.git / summary / log / commit / refs

commit    326335ac136d9c4eafba3451087cc341059e7b1e
Author:   Tatsuo Ishii <ishii@postgresql.org>
Date:     Sun Oct 27 22:58:06 2013 +0000

    Fix on_shmem_exit() to not accept too many on exit functions.
    
    Actually harmless because we currently do not such that many on exit
    functions. But a bug is a bug...
    
    Per Coverity report "1025973 Out-of-bounds write".


src/utils/pool_shmem.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/utils/pool_shmem.c b/src/utils/pool_shmem.c index 4a13d7e99..c2c5df73a 100644 --- a/src/utils/pool_shmem.c +++ b/src/utils/pool_shmem.c @@ -5,7 +5,7 @@ * pgpool: a language independent connection pool server for PostgreSQL * written by Tatsuo Ishii * - * Portions Copyright (c) 2003-2011, PgPool Global Development Group + * Portions Copyright (c) 2003-2013, PgPool Global Development Group * Portions Copyright (c) 2003-2004, PostgreSQL Global Development Group * * Permission to use, copy, modify, and distribute this software and @@ -163,11 +163,13 @@ on_shmem_exit(void (*function) (int code, Datum arg), Datum arg) { if (on_shmem_exit_index >= MAX_ON_EXITS) pool_error("out of on_shmem_exit slots"); + else + { + on_shmem_exit_list[on_shmem_exit_index].function = function; + on_shmem_exit_list[on_shmem_exit_index].arg = arg; - on_shmem_exit_list[on_shmem_exit_index].function = function; - on_shmem_exit_list[on_shmem_exit_index].arg = arg; - - ++on_shmem_exit_index; + ++on_shmem_exit_index; + } } /* [parent: ec9c1d26e5c3]