Fix replication delay worker segfault when application_name is an empty string.
authorTatsuo Ishii <ishii@sraoss.co.jp>
Thu, 12 Dec 2019 07:33:18 +0000 (16:33 +0900)
committerTatsuo Ishii <ishii@sraoss.co.jp>
Thu, 12 Dec 2019 09:18:19 +0000 (18:18 +0900)
commit5f6410d22aa43f6360b565e147606307fb59f8dc
treef9f248133b6f825f12dfafedb4dff84c010eef12
parentc959c8b6c7b9e5a18e6a94e683e51d842e4381fa
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