summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTatsuo Ishii2019-12-12 07:33:18 +0000
committerTatsuo Ishii2019-12-12 09:19:20 +0000
commitae0dbfc216ccfab1e1c39624785df569c13fe84e (patch)
tree4bfc57784a87b5f74fb342ab1fca08c35c6a3503
parent449666efd347c81061bde48f13f379cc8a13927c (diff)
Fix replication delay worker segfault when application_name is an empty string.V3_4_STABLE
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.
-rw-r--r--src/protocol/pool_process_query.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/protocol/pool_process_query.c b/src/protocol/pool_process_query.c
index 66dbb0aa1..09a2c28af 100644
--- a/src/protocol/pool_process_query.c
+++ b/src/protocol/pool_process_query.c
@@ -2747,7 +2747,7 @@ void do_query(POOL_CONNECTION *backend, char *query, POOL_SELECT_RESULT **result
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);
@@ -2770,7 +2770,7 @@ void do_query(POOL_CONNECTION *backend, char *query, POOL_SELECT_RESULT **result
res->nullflags[num_data] = len;
- if (len > 0)
+ if (len >= 0)
{
p = pool_read2(backend, len);
res->data[num_data] = palloc(len + 1);