pgpool2.git / summary / log / commit / refs

commit    638d2bbb0210b1785f852f1cd95c3c175a8a78ff
Author:   Tatsuo Ishii <ishii@sraoss.co.jp>
Date:     Thu Dec 12 07:33:18 2019 +0000

    Fix replication delay worker segfault when application_name is an empty string.
    
    The process calls do_query() to obtain the query result against
    pg_stat_replication_view.  If user sets application_name to an empty
    string, the result data row packet length will be 0. However
    do_query() did not consider the length == 0 case, which resulted in
    giving NULL pointer to strcmp() which is called from the worker
    process. That means the bug is not specific to this case (a new
    feature added in Pgpool-II 4.1) but it potentially affects many other
    places where do_query() gets called, although it had not been reported
    in the field. So this fix should be applied to all supported branches.
    
    Per bug 565.


src/protocol/pool_process_query.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/protocol/pool_process_query.c b/src/protocol/pool_process_query.c index a4f45833d..7002ff238 100644 --- a/src/protocol/pool_process_query.c +++ b/src/protocol/pool_process_query.c @@ -2309,7 +2309,7 @@ do_query(POOL_CONNECTION * backend, char *query, POOL_SELECT_RESULT * *result, i res->nullflags[num_data] = len; - if (len > 0) /* NOT NULL? */ + if (len >= 0) /* NOT NULL? */ { res->data[num_data] = palloc(len + 1); memcpy(res->data[num_data], p, len); @@ -2332,7 +2332,7 @@ do_query(POOL_CONNECTION * backend, char *query, POOL_SELECT_RESULT * *result, i res->nullflags[num_data] = len; - if (len > 0) + if (len >= 0) { p = pool_read2(backend, len); res->data[num_data] = palloc(len + 1); [parent: 54c30a3fc480]