From 3ce231a57115f9e571115c01fc7a3b7c109da166 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Mon, 19 Sep 2016 14:04:21 +0900 Subject: [PATCH] Ensure get_pg_settings() returns false if parameter not found Previously, if e.g. a non-superuser connection is used to get a value like `data_directory`, which is available to superusers only, it would return true. --- dbutils.c | 2 +- repmgr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dbutils.c b/dbutils.c index 0f3727d3..83f6bccf 100644 --- a/dbutils.c +++ b/dbutils.c @@ -504,7 +504,7 @@ get_pg_setting(PGconn *conn, const char *setting, char *output) char sqlquery[QUERY_STR_LEN]; PGresult *res; int i; - bool success = true; + bool success = false; sqlquery_snprintf(sqlquery, "SELECT name, setting " diff --git a/repmgr.c b/repmgr.c index f37bc8db..98822ee5 100644 --- a/repmgr.c +++ b/repmgr.c @@ -3697,7 +3697,7 @@ do_standby_switchover(void) /* the remote server is the primary to be demoted */ char remote_conninfo[MAXCONNINFO] = ""; char remote_host[MAXLEN]; - char remote_data_directory[MAXLEN]; + char remote_data_directory[MAXPGPATH] = ""; int remote_node_id; char remote_node_replication_state[MAXLEN] = ""; char remote_archive_config_dir[MAXLEN];